[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:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user