From fe83659dbf1bba930eaac9099542ff97241facc1 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Wed, 16 Oct 2019 08:46:32 +0000 Subject: [PATCH] [FIX] stock: lot default company. closes odoo/odoo#39464 X-original-commit: d0cd57c90bcfdcf98698a68acabdc72001406d13 Signed-off-by: Victor Feyens (vfe) --- addons/stock/models/product.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index a8151ca1547..eb887af6cdd 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -475,7 +475,11 @@ class Product(models.Model): self.ensure_one() action = self.env.ref('stock.action_production_lot_form').read()[0] action['domain'] = [('product_id', '=', self.id)] - action['context'] = {'default_product_id': self.id, 'set_product_readonly': True} + action['context'] = { + 'default_product_id': self.id, + 'set_product_readonly': True, + 'default_company_id': (self.company_id or self.env.company).id, + } return action # Be aware that the exact same function exists in product.template @@ -779,7 +783,10 @@ class ProductTemplate(models.Model): self.ensure_one() action = self.env.ref('stock.action_production_lot_form').read()[0] action['domain'] = [('product_id.product_tmpl_id', '=', self.id)] - action['context'] = {'default_product_tmpl_id': self.id} + action['context'] = { + 'default_product_tmpl_id': self.id, + 'default_company_id': (self.company_id or self.env.company).id, + } if self.product_variant_count == 1: action['context'].update({ 'default_product_id': self.product_variant_id.id,