From 3549688b21eb65e16b9c3f2b6462eb8d8b52cd47 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Mon, 4 Dec 2017 16:28:46 +0100 Subject: [PATCH] [FIX] account: fix reconciliation that create double entries in some case commit 2f3b469dee6f18cbccce1cdf2a81cfe57960c533 fixes a problem where open balance had to be added in the lines to create, however in the case where no line is selected, a new one is created automatically (for usability purpose) and the balance was not update correctly, resulting in the creation of a double entry. --- .../static/src/js/reconciliation/reconciliation_model.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 36c855111f7..4fbd083e7d9 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -602,9 +602,14 @@ var StatementModel = BasicModel.extend({ var line = self.getLine(handle); var props = _.filter(line.reconciliation_proposition, function (prop) {return !prop.is_tax && !prop.invalid;}); if (props.length === 0) { + // Usability: if user has not choosen any lines and click validate, it has the same behavior + // as creating a write-off of the same amount. props.push(self._formatQuickCreate(line, { account_id: [line.st_line.open_balance_account_id, self.accounts[line.st_line.open_balance_account_id]], })); + // update balance of line otherwise it won't be to zero and another line will be added + line.reconciliation_proposition.push(props[0]); + self._computeLine(line); } ids.push(line.id); var values_dict = {