From cc2bd6717df379e87c9dfc485aa51f8dd33f6b76 Mon Sep 17 00:00:00 2001 From: Adrien Widart Date: Tue, 12 Jan 2021 08:52:15 +0000 Subject: [FIX] pos_cache: add pos to product When adding a product to the order, the total will be updated but the orderline will not be displayed To reproduce the error: 1. Go to Point Of Sale 2. New Session 3. Click on a product so it will be added to the order Err: The order's total is correctly updated but the line is not displayed. When displaying an orderline, the system wants to use the product's unit name (`t-esc="props.line.get_unit().name"`). To do so, it uses one specific variable of the current product, `pos`: https://github.com/odoo/odoo/blob/abff1ca94bcc829250b63fd9677890988b796819/addons/point_of_sale/static/src/js/models.js#L1518-L1528 When using the standard Point of Sale, this variable is added on products loading (L446) : https://github.com/odoo/odoo/blob/abff1ca94bcc829250b63fd9677890988b796819/addons/point_of_sale/static/src/js/models.js#L438-L448 However, this variable is not set when using the pos_cache module. OPW-2431221 closes odoo/odoo#64380 Signed-off-by: pimodoo --- addons/pos_cache/static/src/js/pos_cache.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/pos_cache/static/src/js/pos_cache.js') diff --git a/addons/pos_cache/static/src/js/pos_cache.js b/addons/pos_cache/static/src/js/pos_cache.js index 9f6bf6961ea..4f840082fb1 100644 --- a/addons/pos_cache/static/src/js/pos_cache.js +++ b/addons/pos_cache/static/src/js/pos_cache.js @@ -40,6 +40,7 @@ models.PosModel = models.PosModel.extend({ return records.then(function (products) { self.db.add_products(_.map(products, function (product) { product.categ = _.findWhere(self.product_categories, {'id': product.categ_id[0]}); + product.pos = self; return new models.Product({}, product); })); }); -- cgit v1.2.3