From 483024d122565523a8f1788201ecce47c6d1dfd0 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 16 Nov 2016 18:34:56 +0100 Subject: [PATCH] [FIX] product: `_compute_currency_id` multi-company By default, the multi-company record rule on `product.template` is disabled, meaning the products are shared between the companies. https://github.com/odoo/odoo/blob/10.0/addons/product/security/product_security.xml#L48 Nevertheless, the multi-company record rule on `res.company` is well activated, and therefore this might happen that you can see a `product.template` for which you are not allowed to read the company. If you attempt to read something from this company, you must therefore do it as sudo :) opw-693209 --- addons/product/models/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index 2b2508cce9d..911481a003b 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -151,7 +151,7 @@ class ProductTemplate(models.Model): except ValueError: main_company = self.env['res.company'].sudo().search([], limit=1, order="id") for template in self: - template.currency_id = template.company_id.currency_id.id or main_company.currency_id.id + template.currency_id = template.company_id.sudo().currency_id.id or main_company.currency_id.id @api.multi def _compute_template_price(self):