Skip to content

Commit

Permalink
[FIX] account: bank statement reconciliation widget: create move line…
Browse files Browse the repository at this point in the history
… + partial reconcile now possible
  • Loading branch information
Whisno committed Sep 10, 2014
1 parent bfb2923 commit 242fbc2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions addons/account/static/src/js/account_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,10 +1029,12 @@ openerp.account = function (instance) {
partnerNameClickHandler: function() {
var self = this;
// Delete statement line's partner
return self.changePartner('', function() {
self.$(".partner_name").hide();
self.$(".change_partner_container").show();
});
if (window.confirm(_t("Reset the statement line's partner ?"))) {
return self.changePartner('', function() {
self.$(".partner_name").hide();
self.$(".change_partner_container").show();
});
}
},


Expand Down Expand Up @@ -1374,10 +1376,9 @@ openerp.account = function (instance) {
var self = this;
var mv_lines_selected = self.get("mv_lines_selected");
var lines_selected_num = mv_lines_selected.length;
var lines_created_num = self.getCreatedLines().length;

// Undo partial reconciliation if necessary
if (lines_selected_num !== 1 || lines_created_num !== 0) {
if (lines_selected_num !== 1) {
_.each(mv_lines_selected, function(line) {
if (line.partial_reconcile === true) self.unpartialReconcileLine(line);
if (line.propose_partial_reconcile === true) line.propose_partial_reconcile = false;
Expand All @@ -1394,12 +1395,12 @@ openerp.account = function (instance) {
_.each(self.getCreatedLines(), function(o) {
balance += o.amount;
});
// Should work as long as currency's rounding factor is > 0.001 (ie: don't use gold kilos as a currency)
// Dealing with floating-point
balance = Math.round(balance*1000)/1000;
self.set("balance", balance);

// Propose partial reconciliation if necessary
if (lines_selected_num === 1 && lines_created_num === 0 && self.st_line.amount * balance > 0) {
if (lines_selected_num === 1 && self.st_line.amount * balance > 0 && ! mv_lines_selected[0].partial_reconcile) {
mv_lines_selected[0].propose_partial_reconcile = true;
self.updateAccountingViewMatchedLines();
}
Expand Down

0 comments on commit 242fbc2

Please sign in to comment.