From 420e433fa3a6b671868fa578e6006dd215570706 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 23 Aug 2017 18:07:38 +0200 Subject: [PATCH] Revert "[FIX] website_sale: Avoid compute tax for every company" This reverts commit 04cddc447b89906ed3001c89993a90e934b05adf. Public user can't read taxes (map_tax() only play with ids) --- addons/website_sale/models/product.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 5d372588088..d3e1c6b893a 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -190,9 +190,7 @@ class Product(models.Model): def _website_price(self): qty = self._context.get('quantity', 1.0) partner = self.env.user.partner_id - current_website = self.env['website'].get_current_website() - pricelist = current_website.get_current_pricelist() - company_id = current_website.company_id + pricelist = self.env['website'].get_current_website().get_current_pricelist() context = dict(self._context, pricelist=pricelist.id, partner=partner) self2 = self.with_context(context) if self._context != context else self @@ -200,7 +198,7 @@ class Product(models.Model): ret = self.env.user.has_group('sale.group_show_price_subtotal') and 'total_excluded' or 'total_included' for p, p2 in zip(self, self2): - taxes = partner.property_account_position_id.map_tax(p.taxes_id.filtered(lambda x: x.company_id == company_id)) + taxes = partner.property_account_position_id.map_tax(p.taxes_id) p.website_price = taxes.compute_all(p2.price, pricelist.currency_id, quantity=qty, product=p2, partner=partner)[ret] p.website_public_price = taxes.compute_all(p2.lst_price, quantity=qty, product=p2, partner=partner)[ret]