[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
This commit is contained in:
Goffin Simon 2015-11-30 14:14:26 +01:00
parent 1f07b9429c
commit c02d0287d8
1 changed files with 8 additions and 2 deletions

View File

@ -1303,8 +1303,14 @@ openerp.account = function (instance) {
// Show or hide partial reconciliation // Show or hide partial reconciliation
if (self.get("mv_lines_selected").length > 0) { 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; var last_line = _.last(self.get("mv_lines_selected"));
self.get("mv_lines_selected")[0].propose_partial_reconcile = propose_partial; 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(); self.updateAccountingViewMatchedLines();
} }