[FIX] stock: lot default company.

closes odoo/odoo#39464

X-original-commit: d0cd57c90bcfdcf98698a68acabdc72001406d13
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2019-10-28 15:48:20 +00:00
committed by fw-bot
parent 7aa813d023
commit fe83659dbf
+9 -2
View File
@@ -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,