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

Module: Purchase Unreconciled

Entity: purchase.order

Compute Method: _compute_unreconciled

Inputs Method Outputs
  • company_id
  • id
  • company_id.currency_id
acc_item = self.env["account.move.line"]
for rec in self:
            domain = rec.with_company(
                rec.company_id
            )._get_purchase_unreconciled_base_domain()
            domain_account = rec._get_account_domain()
            unreconciled_domain = expression.AND([domain, domain_account])
            unreconciled_domain = expression.AND(
                [unreconciled_domain, [("purchase_order_id", "=", rec.id)]]
            )
            unreconciled_items = acc_item.search(unreconciled_domain)
            rec.unreconciled = len(unreconciled_items) > 0
            rec.amount_unreconciled = rec.company_id.currency_id.round(
                sum(unreconciled_items.mapped("amount_residual"))
            )

Back to entity