[IMP] mrp: remove field date_start_wo

This field has been removed, and we now use `date_plan_start` instead.

Task #1970595
This commit is contained in:
Debauche Stéphane
2019-12-30 14:27:19 +00:00
parent 490addf86b
commit b7f46da90d
3 changed files with 17 additions and 30 deletions
+1 -6
View File
@@ -110,11 +110,6 @@ class MrpProduction(models.Model):
help="Informative date allowing to define when the manufacturing order should be processed at the latest to fulfill delivery on time.")
date_start = fields.Datetime('Start Date', copy=False, index=True, readonly=True)
date_finished = fields.Datetime('End Date', copy=False, index=True, readonly=True)
date_start_wo = fields.Datetime(
'Plan From', copy=False, readonly=True,
help="Work orders will be planned based on the availability of the work centers\
starting from this date. If empty, the work orders will be planned as soon as possible.",
)
bom_id = fields.Many2one(
'mrp.bom', 'Bill of Material',
readonly=True, states={'draft': [('readonly', False)]},
@@ -721,7 +716,7 @@ class MrpProduction(models.Model):
return True
def _get_start_date(self):
return self.date_start_wo or datetime.datetime.now()
return self.date_planned_start or datetime.datetime.now()
def _plan_workorders(self, replan=False):
""" Plan all the production's workorders depending on the workcenters
+9 -9
View File
@@ -1011,7 +1011,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
production_table_form.bom_id = self.mrp_bom_desk
production_table_form.product_qty = 1.0
production_table_form.product_uom_id = dining_table.uom_id
production_table_form.date_start_wo = date_start
production_table_form.date_planned_start = date_start
production_table = production_table_form.save()
production_table.action_confirm()
@@ -1075,7 +1075,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = planned_date
mo_form.date_planned_start = planned_date
mo = mo_form.save()
mo.action_confirm()
mo.button_plan()
@@ -1093,7 +1093,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = planned_date
mo_form.date_planned_start = planned_date
mo = mo_form.save()
mo.action_confirm()
mo.button_plan()
@@ -1154,9 +1154,9 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = datetime(2019, 5, 13, 14, 0, 0, 0)
mo_form.date_planned_start = datetime(2019, 5, 13, 14, 0, 0, 0)
mo = mo_form.save()
start = mo.date_start_wo
start = mo.date_planned_start
mo.action_confirm()
mo.button_plan()
self.assertEqual(mo.workorder_ids[0].workcenter_id, self.wc_alt_2, "wrong workcenter")
@@ -1170,7 +1170,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = datetime(2019, 5, 13, 9, 0, 0, 0)
mo_form.date_planned_start = datetime(2019, 5, 13, 9, 0, 0, 0)
mo = mo_form.save()
mo.action_confirm()
mo.button_plan()
@@ -1236,7 +1236,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = datetime(2019, 5, 13, 9, 0, 0, 0)
mo_form.date_planned_start = datetime(2019, 5, 13, 9, 0, 0, 0)
mo = mo_form.save()
mo.action_confirm()
mo.button_plan()
@@ -1253,7 +1253,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = datetime(2019, 5, 13, 9, 0, 0, 0)
mo_form.date_planned_start = datetime(2019, 5, 13, 9, 0, 0, 0)
mo = mo_form.save()
mo.action_confirm()
mo.button_plan()
@@ -1292,7 +1292,7 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
mo_form.product_id = self.product_4
mo_form.bom_id = self.planning_bom
mo_form.product_qty = 1
mo_form.date_start_wo = planned_date
mo_form.date_planned_start = planned_date
mo = mo_form.save()
mo.action_confirm()
# Plans the MO and checks the date.
+7 -15
View File
@@ -116,30 +116,22 @@
</group>
<group>
<field name="date_deadline" attrs="{'readonly': [('state', 'in', ['done', 'cancel'])]}"/>
<field name="date_start_wo"
attrs="{'invisible': [
'|',
'&amp;',
('routing_id', '!=', False),
('state', 'not in', ['draft', 'confirmed']),
('routing_id', '=', False),
], 'readonly': [
('routing_id', '!=', False),
('state', 'not in', ['draft', 'confirmed']),
]}"/>
<div class="o_row o_td_label">
<label for="date_planned_start" string="Planned Date"
attrs="{'invisible': [
('routing_id', '!=', False),
('state', 'in', ['draft', 'confirmed'])
]}"/>
<label for="date_planned_start" string="Plan from"
attrs="{'invisible': [
'|',
('routing_id', '=', False),
('state', 'not in', ['draft', 'confirmed'])
]}"/>
</div>
<div class="o_row">
<field name="date_planned_start"
attrs="{'invisible': [
('routing_id', '!=', False),
('state', 'in', ['draft', 'confirmed']),
], 'readonly': [
attrs="{'readonly': [
'|',
'&amp;',
('routing_id', '=', False),