[FIX] mrp: populating bom lines on import

Issue

	- Install MRP
	- MO > Import with BOM

	The lines are not populated but it
	was the case in v12.

Cause

	In 7206b385b5, the lines generation
	are done in a onchange but they are
	not trigerred in imports

Solution

	Call the onchange manually when we
	are in an import case

OPW-2188066

closes odoo/odoo#45118

X-original-commit: 26c44fae1ad8a3ac2d79d9673255aef12fddeb17
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
This commit is contained in:
jvm-odoo
2020-02-11 16:22:51 +00:00
committed by Nicolas Martinelli
parent fe8036537d
commit a0e2c8a765
+5 -1
View File
@@ -558,7 +558,11 @@ class MrpProduction(models.Model):
values['name'] = self.env['ir.sequence'].next_by_code('mrp.production') or _('New')
if not values.get('procurement_group_id'):
values['procurement_group_id'] = self.env["procurement.group"].create({'name': values['name']}).id
return super(MrpProduction, self).create(values)
production = super(MrpProduction, self).create(values)
# Trigger move_raw creation when importing a file
if 'import_file' in self.env.context:
production._onchange_move_raw()
return production
def unlink(self):
if any(production.state == 'done' for production in self):