[FIX] stock: route_sequence in multi-company

- Go to Inventory > Configuration > Warehouse Management > Routes >
   Make To Order
- Edit
- Swap two rules with the handles
- Save

An access error is raised.

This is due to the recomputation of `route_sequence` which is performed
on all companies.

Setting it as `compute_sudo` solves the problem.

opw-2072159

closes odoo/odoo#38104

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-10-08 08:09:50 +00:00
parent f064437f06
commit 8d910c59b5
+1 -1
View File
@@ -51,7 +51,7 @@ class StockRule(models.Model):
"Trigger Another Rule: the system will try to find a stock rule to bring the products in the source location. The available stock will be ignored.\n"
"Take From Stock, if Unavailable, Trigger Another Rule: the products will be taken from the available stock of the source location."
"If there is no stock available, the system will try to find a rule to bring the products in the source location.")
route_sequence = fields.Integer('Route Sequence', related='route_id.sequence', store=True, readonly=False)
route_sequence = fields.Integer('Route Sequence', related='route_id.sequence', store=True, readonly=False, compute_sudo=True)
picking_type_id = fields.Many2one(
'stock.picking.type', 'Operation Type',
required=True, check_company=True)