From 76a462eb9dffdc5969dc2c30d1c0ba8abfa833a1 Mon Sep 17 00:00:00 2001 From: "Denis Ledoux dle@openerp.com" <> Date: Mon, 19 Nov 2012 11:48:50 +0100 Subject: [PATCH] [FIX]Select boxes field not reloaded at each do search call, only the option of them are reloaded at each search. Select boxes now just below the create button, like this the help message appears below the select boxes and not anymore above : ) bzr revid: dle@openerp.com-20121119104850-0krxa7fil3cx2yys --- .../src/js/account_move_line_quickadd.js | 26 ++++++++++++++----- .../src/xml/account_move_line_quickadd.xml | 18 ++----------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/addons/account/static/src/js/account_move_line_quickadd.js b/addons/account/static/src/js/account_move_line_quickadd.js index 6820415b984..d36565d2ecf 100644 --- a/addons/account/static/src/js/account_move_line_quickadd.js +++ b/addons/account/static/src/js/account_move_line_quickadd.js @@ -20,17 +20,16 @@ openerp.account.quickadd = function (instance) { this.default_period = null; this.default_journal = null; }, - load_list: function() { - var self = this; + start:function(){ var tmp = this._super.apply(this, arguments); - - this.$el.prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this})); + var self = this; + this.$el.parent().prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this})); - this.$(".oe_account_select_journal").change(function() { + this.$el.parent().find('.oe_account_select_journal').change(function() { self.current_journal = parseInt(this.value); self.do_search(self.last_domain, self.last_context, self.last_group_by); }); - this.$(".oe_account_select_period").change(function() { + this.$el.parent().find('.oe_account_select_period').change(function() { self.current_period = parseInt(this.value); self.do_search(self.last_domain, self.last_context, self.last_group_by); }); @@ -53,6 +52,20 @@ openerp.account.quickadd = function (instance) { })).then(function () { self.current_journal = self.current_journal === null ? self.default_journal : self.current_journal; self.current_period = self.current_period === null ? self.default_period :self.current_period; + var o; + //self.$('.oe_account_select_journal',self.$el.parent())[0].children().remove().end(); + self.$el.parent().find('.oe_account_select_journal').children().remove().end(); + for (var i = 0;i < self.journals.length;i++){ + o = new Option(self.journals[i][1], self.journals[i][0]); + self.$el.parent().find('.oe_account_select_journal').append(o); + } + self.$el.parent().find('.oe_account_select_period').children().remove().end(); + for (var i = 0;i < self.periods.length;i++){ + o = new Option(self.periods[i][1], self.periods[i][0]); + self.$el.parent().find('.oe_account_select_period').append(o); + } + self.$el.parent().find('.oe_account_select_journal').val(self.current_journal).attr('selected',true); + self.$el.parent().find('.oe_account_select_period').val(self.current_period).attr('selected',true); return self.search_by_journal_period(); }); }, @@ -84,7 +97,6 @@ openerp.account.quickadd = function (instance) { self.last_context["journal_id"] = self.current_journal; self.last_context["period_id"] = self.current_period; var compoundContext = self.last_context; - debugger; return self.old_search(compoundDomain, compoundContext, self.last_group_by); }, /*_next: function (next_record, options) { diff --git a/addons/account/static/src/xml/account_move_line_quickadd.xml b/addons/account/static/src/xml/account_move_line_quickadd.xml index ac79d32a393..3ed66eec917 100644 --- a/addons/account/static/src/xml/account_move_line_quickadd.xml +++ b/addons/account/static/src/xml/account_move_line_quickadd.xml @@ -7,27 +7,13 @@

Period :

Journal :