diff options
| author | ahenriquez <ahenriquez@eficent.com> | 2020-04-22 11:00:04 +0000 |
|---|---|---|
| committer | ahenriquez <ahenriquez@eficent.com> | 2020-05-11 10:17:40 +0000 |
| commit | eb2c9e07ba5e28a4cd4c76ab2bf85353c042ee77 (patch) | |
| tree | 3c5afb1d8d1919215d4c4af805ea945c809efe98 /addons | |
| parent | 6e69a2bf0bd36204eadff701244c29a387dcd5fd (diff) | |
[IMP] mrp: add hook to prepare procurement values on MO creation
We need a hook to be able to personalize the procurement values
which will be used on procurement group creation when creating MO
closes odoo/odoo#51016
X-original-commit: 9a100e99ad401e5ca6bf45bf8371388c47ec7849
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mrp/models/mrp_production.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 392b1a93819..b87c8716737 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -583,7 +583,8 @@ class MrpProduction(models.Model): else: 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 + procurement_group_vals = self._prepare_procurement_group_vals(values) + values['procurement_group_id'] = self.env["procurement.group"].create(procurement_group_vals).id production = super(MrpProduction, self).create(values) production.move_raw_ids.write({ 'group_id': production.procurement_group_id.id, @@ -1234,3 +1235,7 @@ class MrpProduction(models.Model): 'create': False, 'edit': False}, 'target': 'new', } + + @api.model + def _prepare_procurement_group_vals(self, values): + return {'name': values['name']} |
