summaryrefslogtreecommitdiff
path: root/addons/pos_restaurant/static/src/js/notes.js
diff options
context:
space:
mode:
authorFrédéric van der Essen <fvdessen@gmail.com>2014-12-31 15:37:47 +0100
committerFrédéric van der Essen <fvdessen@gmail.com>2014-12-31 15:37:47 +0100
commitb3cf5382a4829f03f55ee65933f51271c760ffaf (patch)
tree2cff16b7f4ae85e31b98aaea8f1aa9f53e1fb24a /addons/pos_restaurant/static/src/js/notes.js
parentf15d84094db3bc7115eb68ebde946293d8a14600 (diff)
parentb1379c7173d5bb327c41d6accad0d70e0f8def71 (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/notes.js')
-rw-r--r--addons/pos_restaurant/static/src/js/notes.js29
1 files changed, 13 insertions, 16 deletions
diff --git a/addons/pos_restaurant/static/src/js/notes.js b/addons/pos_restaurant/static/src/js/notes.js
index 1e4c9489f22..2d60b66d62b 100644
--- a/addons/pos_restaurant/static/src/js/notes.js
+++ b/addons/pos_restaurant/static/src/js/notes.js
@@ -1,4 +1,4 @@
-function openerp_restaurant_notes(instance,module){
+openerp.pos_restaurant.load_notes = function(instance,module){
"use strict";
var QWeb = instance.web.qweb;
@@ -41,13 +41,12 @@ function openerp_restaurant_notes(instance,module){
},
});
- module.PosWidget.include({
- orderline_note_click: function(){
- var self = this;
+ module.OrderlineNoteButton = module.ActionButtonWidget.extend({
+ template: 'OrderlineNoteButton',
+ button_click: function(){
var line = this.pos.get_order().get_selected_orderline();
-
if (line) {
- this.screen_selector.show_popup('textarea',{
+ this.gui.show_popup('textarea',{
message: _t('Orderline Note'),
value: line.get_note(),
confirm: function(note) {
@@ -56,16 +55,14 @@ function openerp_restaurant_notes(instance,module){
});
}
},
- build_widgets: function(){
- var self = this;
- this._super();
+ });
- if (this.pos.config.iface_orderline_notes) {
- var button = $(QWeb.render('OrderlineNoteButton'));
- button.click(function(){ self.orderline_note_click(); });
- button.appendTo(this.$('.control-buttons'));
- this.$('.control-buttons').removeClass('oe_hidden');
- }
+ module.define_action_button({
+ 'name': 'orderline_note',
+ 'widget': module.OrderlineNoteButton,
+ 'condition': function(){
+ return this.pos.config.iface_orderline_notes;
},
});
-}
+};
+