From 104f0325eb8f034cda5f36eb986a929b08ff6787 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 13 Feb 2020 14:22:28 +0000 Subject: [PATCH] [FIX] mrp: Wrong production location in multi company Steps to reproduce the bug: - Let's consider two companies C1 and C2 - Let's consider two production locations L1 in C1 and L2 in C2 - Let's consider that the company of SUPERUSER is C1 - Add the field Production location in the form view of mrp.production - Log in C2 - Create a product P with a BOM in C2 with L2 as production location - Create a MO for P Bug: The production location of P was L1 instead L2 PS: related_sudo is set to True by default. opw:2196707 closes odoo/odoo#45692 X-original-commit: aef3d1864826a939fbd9cfd9b666614169a1db0e Signed-off-by: Simon Goffin (sig) --- addons/mrp/models/mrp_production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index da6106f5529..ddd65b934f9 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -222,7 +222,7 @@ class MrpProduction(models.Model): readonly=True, states={'draft': [('readonly', False)]}, default='1') is_locked = fields.Boolean('Is Locked', default=True, copy=False) show_final_lots = fields.Boolean('Show Final Lots', compute='_compute_show_lots') - production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production', readonly=False) # FIXME sle: probably wrong if document in another company + production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production', readonly=False, related_sudo=False) picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this manufacturing order') delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids') confirm_cancel = fields.Boolean(compute='_compute_confirm_cancel')