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

Module: Account Payment Batch OCA

Entity: account.payment.method.line

Compute Method: _compute_default_journal_ids

Inputs Method Outputs
  • payment_method_id
  • payment_method_id.payment_type
  • company_id
  • company_id.id
ptype_map = {
            "outbound": "purchase",
            "inbound": "sale",
        }
for line in self:
            if (
                line.payment_method_id
                and line.payment_method_id.payment_type in ptype_map
            ):
                line.default_journal_ids = list(
                    self.env["account.journal"]._search(
                        [
                            (
                                "type",
                                "=",
                                ptype_map[line.payment_method_id.payment_type],
                            ),
                            ("company_id", "=", line.company_id.id),
                        ]
                    )
                )

Back to entity