[FIX] pos_cache: Adapt JS code to ac89783d2f.

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.
This commit is contained in:
Victor Tabuenca Calvo
2017-11-22 15:25:01 -08:00
committed by Joren Van Onder
parent fae85df8f7
commit c3ce1d4f13
+5 -2
View File
@@ -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);
}));
});
});
},