diff options
| author | jvm-odoo <jvm@odoo.com> | 2020-02-11 12:01:31 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-02-11 16:22:51 +0000 |
| commit | a0e2c8a7658161c1c96eb863f652bd4c926238b0 (patch) | |
| tree | 1e54de6df6f4f3f27c3b00e7b9d482a5cf90f3d1 | |
| parent | fe8036537de22e02e1957c199d9957c72b32320b (diff) | |
[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>
| -rw-r--r-- | addons/mrp/models/mrp_production.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 492e32326c4..13b55c9d334 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -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): |
