diff options
| author | Denis Ledoux <dle@odoo.com> | 2021-02-26 14:45:44 +0000 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2021-02-26 14:45:44 +0000 |
| commit | a08ba4be6518dd99ce93a803724165f62cbef032 (patch) | |
| tree | 5dbf8fc333da2f8cbca1a273aaa144a372a3b735 /addons/google_drive | |
| parent | 1f48021667b810ad7372c49e0e055bfd69c71ca5 (diff) | |
[FIX] purchase_stock: `on_time_rate` product other company than PO
- User in company A,
- Purchase order in company A,
- Product in company B
```
File "/home/odoo/src/odoo/14.0/addons/purchase_stock/models/res_partner.py", line 23, in _compute_on_time_rate
]).filtered(lambda l: l.product_id.product_tmpl_id.type != 'service' and l.order_id.state in ['done', 'purchase'])
File "/home/odoo/src/odoo/14.0/odoo/models.py", line 5279, in filtered
return self.browse([rec.id for rec in self if func(rec)])
File "/home/odoo/src/odoo/14.0/odoo/models.py", line 5279, in <listcomp>
return self.browse([rec.id for rec in self if func(rec)])
File "/home/odoo/src/odoo/14.0/addons/purchase_stock/models/res_partner.py", line 23, in <lambda>
]).filtered(lambda l: l.product_id.product_tmpl_id.type != 'service' and l.order_id.state in ['done', 'purchase'])
File "/home/odoo/src/odoo/14.0/odoo/fields.py", line 2483, in __get__
return super().__get__(records, owner)
File "/home/odoo/src/odoo/14.0/odoo/fields.py", line 998, in __get__
record._fetch_field(self)
File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3072, in _fetch_field
self._read(fnames)
File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3183, in _read
raise self.env['ir.rule']._make_access_error('read', forbidden)
odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Product' (product.product) records.
```
If you do not share products between companies
(if the multi-company record rule for `product.template` is enabled)
then you are not supposed to use a product from another company in a purchase order.
However, this is possible to land in the case if you enable
the multi-company record rule after you created some purchase orders,
using products from other companies.
Adding `sudo()` just to get the type of product
doesn't cost much to support that case
upg-8277
closes odoo/odoo#66936
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Diffstat (limited to 'addons/google_drive')
0 files changed, 0 insertions, 0 deletions
