fix: force account move synchronization by including amount in trigger fields when deductions change
This commit is contained in:
parent
e659fe5edf
commit
ce614c273d
@ -43,11 +43,13 @@ class AccountPayment(models.Model):
|
|||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
"""
|
"""
|
||||||
Override write to manually trigger synchronization when deductions change.
|
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)
|
res = super().write(vals)
|
||||||
if 'deduction_line_ids' in vals or 'amount_substract' in vals:
|
if 'deduction_line_ids' in vals or 'amount_substract' in vals:
|
||||||
# If deductions change, trigger sync to moves
|
# Force trigger sync by pretending amount changed if deductions changed
|
||||||
self._synchronize_to_moves({'deduction_line_ids', 'amount_substract'})
|
self._synchronize_to_moves({'amount', 'deduction_line_ids', 'amount_substract'})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def action_cancel(self):
|
def action_cancel(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user