summaryrefslogtreecommitdiff
path: root/addons/pos_discount/static/src/js/models.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/pos_discount/static/src/js/models.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/pos_discount/static/src/js/models.js')
-rw-r--r--addons/pos_discount/static/src/js/models.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/addons/pos_discount/static/src/js/models.js b/addons/pos_discount/static/src/js/models.js
new file mode 100644
index 00000000..c54c7c93
--- /dev/null
+++ b/addons/pos_discount/static/src/js/models.js
@@ -0,0 +1,21 @@
+odoo.define('pos_discount.models', function (require) {
+ "use strict";
+
+ var models = require('point_of_sale.models');
+
+ var existing_models = models.PosModel.prototype.models;
+ var product_index = _.findIndex(existing_models, function (model) {
+ return model.model === "product.product";
+ });
+ var product_model = existing_models[product_index];
+
+ models.load_models([{
+ model: product_model.model,
+ fields: product_model.fields,
+ order: product_model.order,
+ domain: function(self) {return [['id', '=', self.config.discount_product_id[0]]];},
+ context: product_model.context,
+ loaded: product_model.loaded,
+ }]);
+
+});