From 1f0d6e4cb0d80e764090739c74e81ac05058429d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 25 Jun 2012 12:01:55 +0200 Subject: [PATCH] [IMP] point_of_sale: merged start() with renderElement() where possible bzr revid: fva@openerp.com-20120625100155-3ec0rk2bq61oy0lo --- .../point_of_sale/static/src/js/pos_screens.js | 9 ++++++--- .../point_of_sale/static/src/js/pos_widgets.js | 17 +++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/point_of_sale/static/src/js/pos_screens.js b/addons/point_of_sale/static/src/js/pos_screens.js index 1503ab54784..e055c74584e 100644 --- a/addons/point_of_sale/static/src/js/pos_screens.js +++ b/addons/point_of_sale/static/src/js/pos_screens.js @@ -345,7 +345,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.ScaleProductScreenWidget = module.BaseScreenWidget.extend({ template:'ScaleProductSelectionScreenWidget', - start: function(){ + renderElement: function(){ + this._super(); this.product_categories_widget = new module.ProductCategoriesWidget(this,{ pos:this.pos, product_type: 'weightable', @@ -520,7 +521,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa show_leftpane: true, show_total: true, - start: function(){ + renderElement: function(){ + this._super(); this.product_categories_widget = new module.ProductCategoriesWidget(this,{}); this.product_categories_widget.replace($('.placeholder-ProductCategoriesWidget')); @@ -569,7 +571,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.company = this.pos.get('company'); this.shop_obj = this.pos.get('shop'); }, - start: function() { + renderElement: function() { + this._super(); this.pos.bind('change:selectedOrder', this.change_selected_order, this); this.change_selected_order(); }, diff --git a/addons/point_of_sale/static/src/js/pos_widgets.js b/addons/point_of_sale/static/src/js/pos_widgets.js index 714094f1cbc..9573429c074 100644 --- a/addons/point_of_sale/static/src/js/pos_widgets.js +++ b/addons/point_of_sale/static/src/js/pos_widgets.js @@ -288,9 +288,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa } }, this)); }, - start: function() { - $('button.select-order', this.$element).click(_.bind(this.selectOrder, this)); - $('button.close-order', this.$element).click(_.bind(this.closeOrder, this)); + renderElement:function(){ + this._super(); + this.$('button.select-order').click(_.bind(this.selectOrder, this)); + this.$('button.close-order').click(_.bind(this.closeOrder, this)); }, selectOrder: function(event) { this.pos.set({ @@ -318,7 +319,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.template = 'ActionButtonWidgetWithIcon'; } }, - start: function(){ + renderElement: function(){ + this._super(); if(this.click_action){ this.$element.click(_.bind(this.click_action, this)); } @@ -388,10 +390,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.set_category(); }, - start: function(){ - this.search_and_categories(); - }, - // changes the category. if undefined, sets to root category set_category : function(category){ if(!category){ @@ -428,6 +426,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.renderElement(); self.search_and_categories(category); }); + this.search_and_categories(); }, set_product_type: function(type){ // 'all' | 'weightable' @@ -508,8 +507,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.renderElement(); }); }, - start: function(){ - }, set_weight: function(weight){ for(var i = 0; i < this.product_list.length; i++){ this.product_list[i].set_weight(weight);