From 33166b60a9e0e6b236f39b26e53d925d2790e9db Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 21 Sep 2023 08:09:39 +0700 Subject: fix pricelist get id static --- indoteknik_custom/models/product_template.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 7effc109..ed722d5e 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -411,8 +411,16 @@ class ProductProduct(models.Model): def _compute_web_price(self): for product in self: - product_pricelist_item = self.env['product.pricelist.item'].search( - [('pricelist_id', '=', 1), ('product_id', '=', product.id)], limit=1) + pricelist_id = self.env.context.get('pricelist') + + domain = [('pricelist_id', '=', pricelist_id or 1), ('product_id', '=', product.id)] + product_pricelist_item = self.env['product.pricelist.item'].search(domain, limit=1) + + if product_pricelist_item.base_pricelist_id: + base_pricelist_id = product_pricelist_item.base_pricelist_id.id + domain = [('pricelist_id', '=', base_pricelist_id), ('product_id', '=', product.id)] + product_pricelist_item = self.env['product.pricelist.item'].search(domain, limit=1) + product.web_price = product_pricelist_item.fixed_price def _compute_stock_vendor(self): -- cgit v1.2.3