diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/pos_restaurant/static/src/js/notes.js | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/pos_restaurant/static/src/js/notes.js')
| -rw-r--r-- | addons/pos_restaurant/static/src/js/notes.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/addons/pos_restaurant/static/src/js/notes.js b/addons/pos_restaurant/static/src/js/notes.js new file mode 100644 index 00000000..c2ed95dd --- /dev/null +++ b/addons/pos_restaurant/static/src/js/notes.js @@ -0,0 +1,42 @@ +odoo.define('pos_restaurant.notes', function (require) { +"use strict"; + +var models = require('point_of_sale.models'); + +var _super_orderline = models.Orderline.prototype; +models.Orderline = models.Orderline.extend({ + initialize: function(attr, options) { + _super_orderline.initialize.call(this,attr,options); + this.note = this.note || ""; + }, + set_note: function(note){ + this.note = note; + this.trigger('change',this); + }, + get_note: function(note){ + return this.note; + }, + can_be_merged_with: function(orderline) { + if (orderline.get_note() !== this.get_note()) { + return false; + } else { + return _super_orderline.can_be_merged_with.apply(this,arguments); + } + }, + clone: function(){ + var orderline = _super_orderline.clone.call(this); + orderline.note = this.note; + return orderline; + }, + export_as_JSON: function(){ + var json = _super_orderline.export_as_JSON.call(this); + json.note = this.note; + return json; + }, + init_from_JSON: function(json){ + _super_orderline.init_from_JSON.apply(this,arguments); + this.note = json.note; + }, +}); + +}); |
