[FIX] account: Fix computed fields when editing payment account

When changing the bank account by the outstanding account of a payment, invoice's payment_state should be recomputed by the orm.

So, when writing 'account_id' on the liquidity line, 'is_matched' must be recomputed on payment (_compute_reconciliation_status). Then, if reconciled to some invoices, 'payment_state' must be recomputed as well (_compute_amount).

closes odoo/odoo#65427

X-original-commit: 7caf5316407ab8950216592e38551f29207076de
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Laurent Smet
2021-02-02 17:16:10 +00:00
parent 892e3d7d25
commit e9a62bcd8f
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -1215,8 +1215,10 @@ class AccountMove(models.Model):
return 'paid'
@api.depends(
'line_ids.matched_debit_ids.debit_move_id.move_id.payment_id.is_matched',
'line_ids.matched_debit_ids.debit_move_id.move_id.line_ids.amount_residual',
'line_ids.matched_debit_ids.debit_move_id.move_id.line_ids.amount_residual_currency',
'line_ids.matched_credit_ids.credit_move_id.move_id.payment_id.is_matched',
'line_ids.matched_credit_ids.credit_move_id.move_id.line_ids.amount_residual',
'line_ids.matched_credit_ids.credit_move_id.move_id.line_ids.amount_residual_currency',
'line_ids.debit',
+1 -1
View File
@@ -272,7 +272,7 @@ class AccountPayment(models.Model):
# COMPUTE METHODS
# -------------------------------------------------------------------------
@api.depends('move_id.line_ids.amount_residual', 'move_id.line_ids.amount_residual_currency')
@api.depends('move_id.line_ids.amount_residual', 'move_id.line_ids.amount_residual_currency', 'move_id.line_ids.account_id')
def _compute_reconciliation_status(self):
''' Compute the field indicating if the payments are already reconciled with something.
This field is used for display purpose (e.g. display the 'reconcile' button redirecting to the reconciliation