[FIX] website_sale: fix prices on Products snippet on branch website

Steps to reproduce:
- Create a branch for a company (e.g. Branch X)
- Go to "Website / Configuration / Websites"
- Create or configure a website on Branch X (e.g. Website X)
- Go to "Website / Configuration / Settings"
- Select Website X
- Set "Display Product Prices" to "Tax Included"
- Create a product for a price of $100 and a tax from parent company (e.g. 15%)
- Go Website X
- Edit Home page and add Products snippet

Issue:
On the Products snippet, the price of the product should be "Tax Included" ($115),
but it is not. The displayed price is $100.

Cause:
When computing the prices, taxes from parent companies are not taken into account.

This fix is a complement to https://github.com/odoo/odoo/pull/151223

opw-3660156

closes odoo/odoo#152105

X-original-commit: ba6cb4f16fdbfa121e52f3c17c70e9783e8c2ea5
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
This commit is contained in:
Anh Thao Pham (pta)
2024-02-01 07:06:59 +00:00
parent 873a13ef62
commit 96560c4db6
@@ -111,7 +111,7 @@ class Product(models.Model):
price = self._get_contextual_price()
website = self.env['website'].get_current_website()
line_tax_type = website.show_line_subtotals_tax_selection
company_taxes = self.taxes_id.filtered(lambda tax: tax.company_id == self.env.company)
company_taxes = self.taxes_id.filtered(lambda tax: tax.company_id in self.env.company.parent_ids)
if line_tax_type == "tax_included" and company_taxes:
price = company_taxes.compute_all(price, product=self, partner=self.env['res.partner'])['total_included']
return price