[FIX] Use correct company when search for mandate_id

Use the account.move company to search for the right partner mandate
This commit is contained in:
Hugo Santos
2024-02-06 17:31:09 +01:00
parent 8ce292ac62
commit 70c07af9d1

View File

@@ -22,9 +22,10 @@ class AccountMove(models.Model):
related="payment_mode_id.payment_method_id.mandate_required", readonly=True
)
@api.depends("payment_mode_id", "partner_id")
@api.depends("company_id", "payment_mode_id", "partner_id")
def _compute_mandate_id(self):
for move in self:
move = move.with_company(move.company_id)
if move.payment_mode_id.payment_method_id.mandate_required:
move.mandate_id = move.partner_id.valid_mandate_id
else: