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

Inputs Method Outputs
for payment in self:
            if not payment.state:
                payment.state = 'draft'
            # paid --> reconciled
            if (move := payment.move_id) and payment.state in ('paid', 'reconciled'):
                liquidity, _counterpart, _writeoff = payment._seek_for_lines()
                payment.state = (
                    'reconciled'
                    if move.company_currency_id.is_zero(sum(liquidity.mapped('amount_residual'))) else
                    'paid'
                )
            all_invoices_paid = payment.reconciled_invoice_ids and all(inv.payment_state == 'paid' for inv in payment.reconciled_invoice_ids)
            all_bills_paid = payment.reconciled_bill_ids and all(bill.payment_state == 'paid' for bill in payment.reconciled_bill_ids)
            if (
                payment.state == 'paid'
                and payment.outstanding_account_type != 'asset_cash'
                and (all_invoices_paid or all_bills_paid)
            ):
                payment.state = 'reconciled'

Back to entity