diff --git a/mrp_production_request/__manifest__.py b/mrp_production_request/__manifest__.py index 59bf90042..8ada6c881 100644 --- a/mrp_production_request/__manifest__.py +++ b/mrp_production_request/__manifest__.py @@ -6,7 +6,7 @@ "summary": "Allows you to use Manufacturing Request as a previous " "step to Manufacturing Orders for better manufacture " "planification.", - "version": "10.0.1.0.0", + "version": "10.0.1.1.0", "category": "Manufacturing", "website": "https://github.com/OCA/manufacture", "author": "Eficent," diff --git a/mrp_production_request/migrations/10.0.1.1.0/pre-migration.py b/mrp_production_request/migrations/10.0.1.1.0/pre-migration.py new file mode 100644 index 000000000..f5146c392 --- /dev/null +++ b/mrp_production_request/migrations/10.0.1.1.0/pre-migration.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Simone Rubino - Agile Business Group +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +field_renames = [ + ('mrp.production.request', 'mrp_production_request', 'date_planned', + 'date_planned_start') +] + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + openupgrade.rename_fields(env, field_renames) diff --git a/mrp_production_request/models/mrp_production_request.py b/mrp_production_request/models/mrp_production_request.py index 38d5e9ca5..93f599de7 100644 --- a/mrp_production_request/models/mrp_production_request.py +++ b/mrp_production_request/models/mrp_production_request.py @@ -91,9 +91,14 @@ class MrpProductionRequest(models.Model): track_visibility='onchange', readonly=True, states={'draft': [('readonly', False)]}) description = fields.Text('Description') - date_planned = fields.Date( - string='Planned Date', required=True, track_visibility='onchange', - default=fields.Date.context_today) + date_planned_start = fields.Datetime( + 'Deadline Start', copy=False, default=fields.Datetime.now, + index=True, required=True, + states={'confirmed': [('readonly', False)]}, oldname="date_planned") + date_planned_finished = fields.Datetime( + 'Deadline End', copy=False, default=fields.Datetime.now, + index=True, + states={'confirmed': [('readonly', False)]}) company_id = fields.Many2one( comodel_name='res.company', string='Company', required=True, default=_company_get) @@ -108,6 +113,19 @@ class MrpProductionRequest(models.Model): ("cancel", "Cancelled")], index=True, track_visibility='onchange', required=True, copy=False, default='draft') + procurement_group_id = fields.Many2one( + string='Procurement Group', + comodel_name='procurement.group', + copy=False) + procurement_ids = fields.One2many( + string='Related Procurements', + comodel_name='procurement.order', + inverse_name='mrp_production_request_id') + propagate = fields.Boolean( + 'Propagate cancel and split', + help='If checked, when the previous move of the move ' + '(which was generated by a next procurement) is cancelled ' + 'or split, the move generated by this move will too') procurement_id = fields.Many2one( comodel_name="procurement.order", string="Procurement Order", readonly=True) diff --git a/mrp_production_request/views/mrp_production_request_view.xml b/mrp_production_request/views/mrp_production_request_view.xml index cb97907e8..3d268f22a 100644 --- a/mrp_production_request/views/mrp_production_request_view.xml +++ b/mrp_production_request/views/mrp_production_request_view.xml @@ -80,7 +80,8 @@ - + + /> @@ -110,7 +111,7 @@ - + diff --git a/mrp_production_request/wizards/mrp_production_request_create_mo.py b/mrp_production_request/wizards/mrp_production_request_create_mo.py index 2f0c2678e..d969fc032 100644 --- a/mrp_production_request/wizards/mrp_production_request_create_mo.py +++ b/mrp_production_request/wizards/mrp_production_request_create_mo.py @@ -95,7 +95,11 @@ class MrpProductionRequestCreateMo(models.TransientModel): 'location_dest_id': request_id.location_dest_id.id, 'picking_type_id': request_id.picking_type_id.id, 'routing_id': request_id.routing_id.id, - 'date_planned': request_id.date_planned, + 'date_planned_start': request_id.date_planned_start, + 'date_planned_finished': request_id.date_planned_finished, + 'procurement_group_id': request_id.procurement_group_id.id, + 'procurement_ids': [(6, 0, request_id.procurement_ids.ids)], + 'propagate': request_id.propagate, 'company_id': request_id.company_id.id, }