From c0997d332adf78eb42fc3a1a1280dfa25889e7d5 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 5 Aug 2014 10:01:07 +0200 Subject: [PATCH] [FIX] account: fix unexpected invalidation of field account_invoice.reconciled Problem: the field account_invoice.reconciled was invalidated by a workflow signal sent from the compute method of the field. The purpose of the signal was to re-open the invoice when the account move lines were no longer reconciled, for instance after cancelling a reconciliation. Solution: modify the workflow such that it makes an automatic transition from 'paid' to 're-open' when the condition 'not reconciled' is met. This works because the field 'reconciled' is stored, and each recomputation forces a reevaluation the workflow. The signal to re-open the invoice is thus no longer necessary. --- addons/account/account_invoice.py | 2 -- addons/account/account_invoice_workflow.xml | 19 +++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index e509b7e9aa2..1092ec33aea 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -97,8 +97,6 @@ class account_invoice(models.Model): @api.depends('account_id', 'move_id.line_id.account_id', 'move_id.line_id.reconcile_id') def _compute_reconciled(self): self.reconciled = self.test_paid() - if not self.reconciled and self.state == 'paid': - self.signal_workflow('open_test') @api.model def _get_reference_type(self): diff --git a/addons/account/account_invoice_workflow.xml b/addons/account/account_invoice_workflow.xml index 13db193af8d..3d94a0e029c 100644 --- a/addons/account/account_invoice_workflow.xml +++ b/addons/account/account_invoice_workflow.xml @@ -13,14 +13,12 @@ True draft - proforma2 write({'state':'proforma2'}) function - open @@ -35,7 +33,7 @@ invoice_validate() re-open write({'state':'open'}) function - + paid @@ -61,9 +59,9 @@ write({'state':'cancel'}) - account.move.line - move_line_id_payment_get() - test_paid() + + + reconciled @@ -78,7 +76,8 @@ write({'state':'cancel'}) - open_test + + not reconciled @@ -89,9 +88,9 @@ write({'state':'cancel'}) - account.move.line - move_line_id_payment_get() - test_paid() + + + reconciled