summaryrefslogtreecommitdiff
path: root/addons/pos_restaurant/static/src/js/multiprint.js
diff options
context:
space:
mode:
authorFrédéric van der Essen <fvdessen@gmail.com>2014-12-30 16:08:54 +0100
committerFrédéric van der Essen <fvdessen@gmail.com>2014-12-31 15:34:32 +0100
commit5a8838243d62af2ed760a1a69a968d36ccbf1178 (patch)
treeda486af859528d1d097b91dc0a2de3610e7d85e8 /addons/pos_restaurant/static/src/js/multiprint.js
parent68ca9465771d6c22136a05849465afcb543ff8bc (diff)
[WIP] point_of_sale, pos_restaurant: continued refactor
- this time it's the restaurant module that has been refactored - the point of sale extensions points have been reviewed to be more constistent and allow conditional extensions. - the chrome subwidgets are instanciated before screens, so that screens can manipulate them if needed.
Diffstat (limited to 'addons/pos_restaurant/static/src/js/multiprint.js')
-rw-r--r--addons/pos_restaurant/static/src/js/multiprint.js54
1 files changed, 27 insertions, 27 deletions
diff --git a/addons/pos_restaurant/static/src/js/multiprint.js b/addons/pos_restaurant/static/src/js/multiprint.js
index c2d4461c3ae..0ca4695768b 100644
--- a/addons/pos_restaurant/static/src/js/multiprint.js
+++ b/addons/pos_restaurant/static/src/js/multiprint.js
@@ -33,7 +33,7 @@ function openerp_restaurant_multiprint(instance,module){
},
});
- module.PosModel.prototype.models.push({
+ module.load_models({
model: 'restaurant.printer',
fields: ['name','proxy_ip','product_categories_ids'],
domain: null,
@@ -220,39 +220,39 @@ function openerp_restaurant_multiprint(instance,module){
},
});
- module.PosWidget.include({
- build_widgets: function(){
- var self = this;
- this._super();
-
- if(this.pos.printers.length){
- var submitorder = $(QWeb.render('SubmitOrderButton'));
-
- submitorder.click(function(){
- var order = self.pos.get('selectedOrder');
- if(order.hasChangesToPrint()){
- order.printChanges();
- order.saveChanges();
- self.pos_widget.order_widget.update_summary();
- }
- });
-
- submitorder.appendTo(this.$('.control-buttons'));
- this.$('.control-buttons').removeClass('oe_hidden');
+ module.SubmitOrderButton = module.ActionButtonWidget.extend({
+ 'template': 'SubmitOrderButton',
+ button_click: function(){
+ var order = this.pos.get_order();
+ if(order.hasChangesToPrint()){
+ order.printChanges();
+ order.saveChanges();
+ }
+ },
+ hilight: function(hi){
+ if (hi) {
+ this.$el.addClass('highlight');
+ } else {
+ this.$el.removeClass('highlight');
}
},
-
+ });
+
+ module.define_action_button({
+ 'name': 'submit_order',
+ 'widget': module.SubmitOrderButton,
+ 'condition': function() {
+ return this.pos.printers.length;
+ },
});
module.OrderWidget.include({
update_summary: function(){
this._super();
- var order = this.pos.get('selectedOrder');
-
- if(order.hasChangesToPrint()){
- this.pos_widget.$('.order-submit').addClass('highlight');
- }else{
- this.pos_widget.$('.order-submit').removeClass('highlight');
+ var changes = this.pos.get_order().hasChangesToPrint();
+ if (this.getParent().action_buttons &&
+ this.getParent().action_buttons.submit_order) {
+ this.getParent().action_buttons.submit_order.highlight(changes);
}
},
});