summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/pos_discount/static/src/js/discount.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/pos_discount/static/src/js/discount.js b/addons/pos_discount/static/src/js/discount.js
index fc41e55bc05..991e738b3e1 100644
--- a/addons/pos_discount/static/src/js/discount.js
+++ b/addons/pos_discount/static/src/js/discount.js
@@ -3,9 +3,27 @@ odoo.define('pos_discount.pos_discount', function (require) {
var core = require('web.core');
var screens = require('point_of_sale.screens');
+var models = require('point_of_sale.models');
var _t = core._t;
+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,
+}]);
+
+
var DiscountButton = screens.ActionButtonWidget.extend({
template: 'DiscountButton',
button_click: function(){