diff --git a/models/account_payment.py b/models/account_payment.py index 01d8274..2046263 100644 --- a/models/account_payment.py +++ b/models/account_payment.py @@ -43,11 +43,13 @@ class AccountPayment(models.Model): def write(self, vals): """ Override write to manually trigger synchronization when deductions change. + We include 'amount' in the changed_fields to trick Odoo's core sync engine + into refreshing the move lines, which will then include the deductions. """ res = super().write(vals) if 'deduction_line_ids' in vals or 'amount_substract' in vals: - # If deductions change, trigger sync to moves - self._synchronize_to_moves({'deduction_line_ids', 'amount_substract'}) + # Force trigger sync by pretending amount changed if deductions changed + self._synchronize_to_moves({'amount', 'deduction_line_ids', 'amount_substract'}) return res def action_cancel(self):