summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-12-29 15:46:19 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-12-29 15:50:12 +0000
commitb7fa0cfad03a8319f03c1aa89eb67635e1200f67 (patch)
treebd5092f72413cdee897f1334007b939af82991a1
parent0c7219eac4e1bc136fc5351eaa38aa356364dd19 (diff)
[FIX] mrp: avoid traceback on company reset
- Create a new MO - Remove the company name The user see a traceback This occur because the compute method does not check if the company is set opw-2422441 closes odoo/odoo#63889 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
-rw-r--r--addons/mrp/models/mrp_production.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py
index eb8d5400d19..74ee4ccfc45 100644
--- a/addons/mrp/models/mrp_production.py
+++ b/addons/mrp/models/mrp_production.py
@@ -414,6 +414,8 @@ class MrpProduction(models.Model):
@api.depends('product_id', 'company_id')
def _compute_production_location(self):
+ if not self.company_id:
+ return
location_by_company = self.env['stock.location'].read_group([
('company_id', 'in', self.company_id.ids),
('usage', '=', 'production')