From 14accccc1ee5e07e65cbc483ae94dc30da9b2db5 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 21 Sep 2012 15:08:16 +0200 Subject: [PATCH] fixed bug when there is nothing to show bzr revid: nicolas.vanhoren@openerp.com-20120921130816-j7hdewsxp3za3itx --- .../src/js/account_move_reconciliation.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 435de03d289..6b007e2f097 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -64,14 +64,22 @@ openerp.account = function (instance) { }, search_by_partner: function() { var self = this; - return new instance.web.Model("res.partner").call("read", - [self.partners[self.current_partner][0], ["last_reconciliation_date"]]).pipe(function(res) { - self.last_reconciliation_date = - instance.web.format_value(res.last_reconciliation_date, {"type": "datetime"}, _t("Never")); + var fct = function() { return self.old_search(new instance.web.CompoundDomain(self.last_domain, [["partner_id", "in", self.current_partner === null ? [] : [self.partners[self.current_partner][0]] ]]), self.last_context, self.last_group_by); - }); + }; + if (self.current_partner === null) { + self.last_reconciliation_date = _t("Never"); + return fct(); + } else { + return new instance.web.Model("res.partner").call("read", + [self.partners[self.current_partner][0], ["last_reconciliation_date"]]).pipe(function(res) { + self.last_reconciliation_date = + instance.web.format_value(res.last_reconciliation_date, {"type": "datetime"}, _t("Never")); + return fct(); + }); + } }, reconcile: function() { var self = this;