Skip to content

Commit

Permalink
[FIX] stock: multi-company and multi-routes on product
Browse files Browse the repository at this point in the history
- Multi-warehouse + Multi-company setup
- Create Company A with warehouse and 1-step delivery
- Create Company B with warehouse and 1-step delivery
- Switch to Company A: Set Logistics route on product category
  All/Saleable : 1-step delivery
- Switch to Company B: Set Logistics route on product category
  All/Saleable : 1-step delivery
- Switch to Company A, make sure Company B is turned-off
- Create new product and set category to All/Saleable
- Save product

Multi-company error is coming.

This is due to the field `route_from_categ_ids` which is a related, and
therefore fetched as `sudo` by default:

https://github.com/odoo/odoo/blob/f0330d92b31bdae4637ae0c26f40ee07282ab449/odoo/fields.py#L368

Actually, the field doesn't seem to be useful since it is only used in a
view.

Fixes odoo#58357
opw-2390983

closes odoo#62609

X-original-commit: b68b45d
Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
  • Loading branch information
nim-odoo committed Nov 30, 2020
1 parent f8db6c2 commit 52360d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/stock/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ class ProductTemplate(models.Model):
# TDE FIXME: seems only visible in a view - remove me ?
route_from_categ_ids = fields.Many2many(
relation="stock.location.route", string="Category Routes",
related='categ_id.total_route_ids', readonly=False)
related='categ_id.total_route_ids', readonly=False, related_sudo=False)

@api.depends('type')
def _compute_has_available_route_ids(self):
Expand Down

0 comments on commit 52360d5

Please sign in to comment.