[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
This commit is contained in:
Denis Ledoux
2016-11-16 18:38:46 +01:00
parent a2d05a7087
commit 483024d122
+1 -1
View File
@@ -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):