1 function openerp_restaurant_notes(instance,module){
4 var QWeb = instance.web.qweb;
5 var _t = instance.web._t;
7 var _super_orderline = module.Orderline.prototype;
9 module.Orderline = module.Orderline.extend({
10 initialize: function(attr, options) {
11 _super_orderline.initialize.call(this,attr,options);
12 this.note = this.note || "";
14 set_note: function(note){
16 this.trigger('change',this);
18 get_note: function(note){
21 can_be_merged_with: function(orderline) {
22 if (orderline.get_note() !== this.get_note()) {
25 return _super_orderline.can_be_merged_with.call(this,orderline);
29 var orderline = _super_orderline.clone.call(this);
30 orderline.note = this.note;
33 export_as_JSON: function(){
34 var json = _super_orderline.export_as_JSON.call(this);
35 json.note = this.note;
38 init_from_JSON: function(json){
39 _super_orderline.init_from_JSON.apply(this,arguments);
40 this.note = json.note;
44 module.PosWidget.include({
45 orderline_note_click: function(){
47 var line = this.pos.get_order().get_selected_orderline();
50 this.screen_selector.show_popup('textarea',{
51 message: _t('Orderline Note'),
52 value: line.get_note(),
53 confirm: function(note) {
59 build_widgets: function(){
63 if (this.pos.config.iface_orderline_notes) {
64 var button = $(QWeb.render('OrderlineNoteButton'));
65 button.click(function(){ self.orderline_note_click(); });
66 button.appendTo(this.$('.control-buttons'));
67 this.$('.control-buttons').removeClass('oe_hidden');