From a8418fda386ce99010945222743a5cc948a81e6b Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 17 Sep 2012 14:53:09 +0200 Subject: [PATCH] wip bzr revid: nicolas.vanhoren@openerp.com-20120917125309-0ioenvhlkaue1lc6 --- .../src/js/account_move_reconciliation.js | 29 +++++++++++++- .../src/xml/account_move_reconciliation.xml | 39 +++++++------------ 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 5f86171b8e7..c2df0313ffd 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -12,9 +12,22 @@ openerp.account = function (instance) { this.current_partner = null; }, on_loaded: function() { + var self = this; var tmp = this._super.apply(this, arguments); - if (this.partners) + if (this.partners) { this.$el.prepend(QWeb.render("AccountReconciliation", {widget: this})); + this.$("oe_account_recon_previous").click(function() { + self.current_partner = (self.current_partner - 1) % self.partners.length; + self.search_by_partner(); + }); + this.$("oe_account_recon_next").click(function() { + self.current_partner = (self.current_partner + 1) % self.partners.length; + self.search_by_partner(); + }); + this.$("oe_account_recon_reconcile").click(function() { + self.reconcile(); + }); + } return tmp; }, do_search: function(domain, context, group_by) { @@ -25,9 +38,17 @@ openerp.account = function (instance) { this.old_search = _.bind(this._super, this); var mod = new instance.web.Model(this.model, context, domain); return mod.query("partner_id").group_by(["partner_id"]).pipe(function(result) { + var current = self.current_partner !== null ? self.partner[self.current_partner][0] : null; self.partners = _.chain(result).pluck("attributes").pluck("value") .filter(function(el) {return !!el;}).value(); - self.current_partner = self.partners.length == 0 ? null : 0; + var index = _.find(_.range(self.partners.length), function(el) { + if (current === self.partners[el][0]) + return true; + }); + if (index !== undefined) + self.current_partner = index; + else + self.current_partner = self.partners.length == 0 ? null : 0; self.search_by_partner(); }); }, @@ -35,6 +56,10 @@ openerp.account = function (instance) { return this.old_search(new instance.web.CompoundDomain(this.last_domain, [["partner_id", "in", this.current_partner === null ? [] : [this.partners[this.current_partner][0]] ]]), this.last_context, this.last_group_by); }, + reconcile: function() { + var self = this; + var ids = this.get_selected_ids(); + }, }); /*instance.web.views.add('form_clone', 'instance.account.extend_form_view'); diff --git a/addons/account/static/src/xml/account_move_reconciliation.xml b/addons/account/static/src/xml/account_move_reconciliation.xml index 33adc4e64a0..e93790ba58d 100644 --- a/addons/account/static/src/xml/account_move_reconciliation.xml +++ b/addons/account/static/src/xml/account_move_reconciliation.xml @@ -5,33 +5,22 @@
-
-

- Previous - Next - - There is no pending reconciliation. - - + + There is no pending reconciliation. + + +
+

+ + - -

-
-
- Reconcile -
+

+
+
+ +
+
- - -
-
-
- -
-
-
- -