From c02d0287d80ab6ca693f3d6543ff8e94f221d434 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 30 Nov 2015 14:14:26 +0100 Subject: [PATCH] [IMP] account: Bank statement reconciliation It was impossible to make a partial reconciliation with several lines. Each time a new line is proposed for the reconciliation, the previous partial reconcialtion is canceled. The partial reconciliation can just be proposed on the last selected line when: self.get("balance") * (last_line.debit - last_line.credit)<0 --- addons/account/static/src/js/account_widgets.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/account/static/src/js/account_widgets.js b/addons/account/static/src/js/account_widgets.js index 001eacfef7d..0b27139067a 100644 --- a/addons/account/static/src/js/account_widgets.js +++ b/addons/account/static/src/js/account_widgets.js @@ -1303,8 +1303,14 @@ openerp.account = function (instance) { // Show or hide partial reconciliation if (self.get("mv_lines_selected").length > 0) { - var propose_partial = self.getCreatedLines().length === 0 && self.get("mv_lines_selected").length === 1 && balance_type === "greater" && ! self.get("mv_lines_selected")[0].partial_reconcile; - self.get("mv_lines_selected")[0].propose_partial_reconcile = propose_partial; + var last_line = _.last(self.get("mv_lines_selected")); + var propose_partial = self.getCreatedLines().length === 0 + && balance_type === "greater" + && Math.abs(self.get("balance")) < Math.abs(last_line.debit - last_line.credit) + && self.get("balance") * (last_line.debit - last_line.credit) < 0 + && ! last_line.partial_reconcile + && ! last_line.already_paid; + last_line.propose_partial_reconcile = propose_partial; self.updateAccountingViewMatchedLines(); }