[IMP] account: bank statement reconciliation: correctly find reconciliation proposition based on amount match

This commit is contained in:
Arthur Maniet 2014-09-16 12:55:02 +02:00
parent 0952da422d
commit c6ca31dd9f
2 changed files with 11 additions and 5 deletions

View File

@ -544,15 +544,20 @@ class account_bank_statement_line(osv.osv):
sign = 1 sign = 1
if statement_currency == company_currency: if statement_currency == company_currency:
amount_field = 'credit' amount_field = 'credit'
sign = -1
if st_line.amount > 0: if st_line.amount > 0:
amount_field = 'debit' amount_field = 'debit'
else:
sign = -1
else: else:
amount_field = 'amount_currency' amount_field = 'amount_currency'
if st_line.amount < 0: if st_line.amount < 0:
sign = -1 sign = -1
if st_line.amount_currency:
amount = st_line.amount_currency
else:
amount = st_line.amount
match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=1, additional_domain=[(amount_field, '=', (sign * st_line.amount))]) match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=1, additional_domain=[(amount_field, '=', (sign * amount))])
if match_id: if match_id:
return [match_id[0]] return [match_id[0]]

View File

@ -1234,14 +1234,15 @@ openerp.account = function (instance) {
} }
}, },
modeChanged: function() { modeChanged: function(o, val) {
var self = this; var self = this;
self.$(".action_pane.active").removeClass("active"); self.$(".action_pane.active").removeClass("active");
if (self.st_line.has_no_partner && self.get("mode") === "match") { if (self.st_line.has_no_partner && self.get("mode") === "match")
self.set("mode", "create", {silent: true}); self.set("mode", "create", {silent: true});
} if (val.oldValue === "create")
self.addLineBeingEdited();
if (self.get("mode") === "inactive") { if (self.get("mode") === "inactive") {
self.$(".match").slideUp(self.animation_speed); self.$(".match").slideUp(self.animation_speed);