diff options
| author | Frédéric van der Essen <fvdessen@gmail.com> | 2014-12-31 15:37:47 +0100 |
|---|---|---|
| committer | Frédéric van der Essen <fvdessen@gmail.com> | 2014-12-31 15:37:47 +0100 |
| commit | b3cf5382a4829f03f55ee65933f51271c760ffaf (patch) | |
| tree | 2cff16b7f4ae85e31b98aaea8f1aa9f53e1fb24a /addons/pos_restaurant/static/src/js/splitbill.js | |
| parent | f15d84094db3bc7115eb68ebde946293d8a14600 (diff) | |
| parent | b1379c7173d5bb327c41d6accad0d70e0f8def71 (diff) | |
[MERGE] point_of_sale & co. : large js cleanup / refactor.
- See the branch's commit messages for details on the work done.
Diffstat (limited to 'addons/pos_restaurant/static/src/js/splitbill.js')
| -rw-r--r-- | addons/pos_restaurant/static/src/js/splitbill.js | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/addons/pos_restaurant/static/src/js/splitbill.js b/addons/pos_restaurant/static/src/js/splitbill.js index f58f77eedc8..70714418430 100644 --- a/addons/pos_restaurant/static/src/js/splitbill.js +++ b/addons/pos_restaurant/static/src/js/splitbill.js @@ -1,11 +1,9 @@ -function openerp_restaurant_splitbill(instance, module){ +openerp.pos_restaurant.load_splitbill = function(instance, module){ var QWeb = instance.web.qweb; - var _t = instance.web._t; module.SplitbillScreenWidget = module.ScreenWidget.extend({ template: 'SplitbillScreenWidget', - show_leftpane: false, previous_screen: 'products', renderElement: function(){ @@ -29,7 +27,7 @@ function openerp_restaurant_splitbill(instance, module){ this.$('.orderlines').append(linewidget); } this.$('.back').click(function(){ - self.pos_widget.screen_selector.set_current_screen(self.previous_screen); + self.gui.show_screen(self.previous_screen); }); }, @@ -102,7 +100,7 @@ function openerp_restaurant_splitbill(instance, module){ if(full){ - this.pos_widget.screen_selector.set_current_screen('payment'); + this.gui.show_screen('payment'); }else{ for(var id in splitlines){ var split = splitlines[id]; @@ -157,27 +155,29 @@ function openerp_restaurant_splitbill(instance, module){ }, }); - module.PosWidget.include({ - build_widgets: function(){ - var self = this; - this._super(); - - if(this.pos.config.iface_splitbill){ - this.splitbill_screen = new module.SplitbillScreenWidget(this,{}); - this.splitbill_screen.appendTo(this.$('.screens')); - this.screen_selector.add_screen('splitbill',this.splitbill_screen); - - var splitbill = $(QWeb.render('SplitbillButton')); + module.Gui.define_screen({ + 'name': 'splitbill', + 'widget': module.SplitbillScreenWidget, + 'condition': function(){ + return this.pos.config.iface_splitbill; + }, + }); - splitbill.click(function(){ - if(self.pos.get_order().get_orderlines().length > 0){ - self.pos_widget.screen_selector.set_current_screen('splitbill'); - } - }); - - splitbill.appendTo(this.$('.control-buttons')); - this.$('.control-buttons').removeClass('oe_hidden'); + module.SplitbillButton = module.ActionButtonWidget.extend({ + template: 'SplitbillButton', + button_click: function(){ + if(this.pos.get_order().get_orderlines().length > 0){ + self.gui.show_screen('splitbill'); } }, }); -} + + module.define_action_button({ + 'name': 'splitbill', + 'widget': module.SplitbillButton, + 'condition': function(){ + return this.pos.config.iface_splitbill; + }, + }); +}; + |
