summaryrefslogtreecommitdiff
path: root/addons/pos_cache/static
diff options
context:
space:
mode:
authorVictor Tabuenca Calvo <vta@openerp.com>2017-11-21 16:26:53 +0100
committerJoren Van Onder <jov@odoo.com>2017-11-22 15:25:01 -0800
commitc3ce1d4f13735487963e81ccfb32d9182950e49d (patch)
tree2148feae12a5546abf97735c0777cc81ad6124af /addons/pos_cache/static
parentfae85df8f7912ab405a6399f499de6b408644d15 (diff)
[FIX] pos_cache: Adapt JS code to ac89783d2f6c.
Otherwise, when rendering the 'Product' template it crashes when calling the 'get_price' method. Indeed, we need to add products as a Product model instead of as a plain JS object.
Diffstat (limited to 'addons/pos_cache/static')
-rw-r--r--addons/pos_cache/static/src/js/pos_cache.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/pos_cache/static/src/js/pos_cache.js b/addons/pos_cache/static/src/js/pos_cache.js
index 705bd1e66fb..6a26143cc6e 100644
--- a/addons/pos_cache/static/src/js/pos_cache.js
+++ b/addons/pos_cache/static/src/js/pos_cache.js
@@ -37,8 +37,11 @@ models.PosModel = models.PosModel.extend({
args: [self.pos_session.config_id[0], product_fields, product_domain],
});
self.chrome.loading_message(_t('Loading') + ' product.product', 1);
- return records.then(function (product) {
- self.db.add_products(product);
+ return records.then(function (products) {
+ self.db.add_products(_.map(products, function (product) {
+ product.categ = _.findWhere(self.product_categories, {'id': product.categ_id[0]});
+ return new models.Product({}, product);
+ }));
});
});
},