[FIX][mrp_production_request] date_planned field should be named date_planned_start

This commit is contained in:
Simone Rubino
2018-07-13 15:11:23 +02:00
committed by Lois Rilo
parent f832e9ec00
commit b71a284dca
5 changed files with 45 additions and 7 deletions

View File

@@ -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,"

View File

@@ -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)

View File

@@ -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)

View File

@@ -80,7 +80,8 @@
<field name="location_src_id"/>
<field name="location_dest_id"/>
<field name="picking_type_id"/>
<field name="date_planned"/>
<field name="date_planned_start"/>
<field name="date_planned_finished" invisible="1"/>/>
</group>
</group>
@@ -110,7 +111,7 @@
<field name="pending_qty"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="origin"/>
<field name="date_planned"/>
<field name="date_planned_start"/>
<field name="state"/>
</tree>
</field>

View File

@@ -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,
}