Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Invoicing

Entity: account.payment

Compute Method: _compute_state

View 19.0
Inputs Method Outputs
  • state
  • move_id
  • reconciled_invoice_ids
  • reconciled_bill_ids
+ paid_payments_to_recompute = self.env['account.payment']
+ for payment in self:
+             if not payment.state:
+                 payment.state = 'draft'
+             # in_process --> paid
+             if (move := payment.move_id) and payment.state in ('paid', 'in_process'):
+                 liquidity, _counterpart, _writeoff = payment._seek_for_lines()
+                 payment.state = (
+                     'paid'
+                     if move.company_currency_id.is_zero(sum(liquidity.mapped('amount_residual'))) or not any(liquidity.account_id.mapped('reconcile')) else
+                     'in_process'
+                 )
+             if payment.state == 'in_process' and (moves := (payment.reconciled_invoice_ids | payment.reconciled_bill_ids)) and all(invoice.payment_state == 'paid' for invoice in moves):
+                 payment.state = 'paid'
+                 paid_payments_to_recompute |= payment
+ self.env.add_to_compute(self._fields['is_matched'], paid_payments_to_recompute)
  • state

Back to entity