[IMP] mrp: improve the usability of workorder Gantt view
- display WO in red which has a late planned start date. - hide the WO which are in done or cancel state. - show progress of WO. task-1939533
This commit is contained in:
committed by
Simon Lejeune
parent
a5d42ff6d9
commit
90df41f0da
@@ -83,6 +83,7 @@ class MrpWorkorder(models.Model):
|
||||
duration_percent = fields.Integer(
|
||||
'Duration Deviation (%)', compute='_compute_duration',
|
||||
group_operator="avg", readonly=True, store=True)
|
||||
progress = fields.Float('Progress Done (%)', digits=(16, 2), compute='_compute_progress')
|
||||
|
||||
operation_id = fields.Many2one(
|
||||
'mrp.routing.workcenter', 'Operation') # Should be used differently as BoM can change in the meantime
|
||||
@@ -232,6 +233,15 @@ class MrpWorkorder(models.Model):
|
||||
else:
|
||||
order.duration_percent = 0
|
||||
|
||||
def _compute_progress(self):
|
||||
for order in self:
|
||||
if order.state == 'done':
|
||||
order.progress = 100
|
||||
elif order.duration_expected:
|
||||
order.progress = order.duration * 100 / order.duration_expected
|
||||
else:
|
||||
order.progress = 0
|
||||
|
||||
def _compute_working_users(self):
|
||||
""" Checks whether the current user is working, all the users currently working and the last user that worked. """
|
||||
for order in self:
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
@mixin gantt-decoration-color($color) {
|
||||
background-image: linear-gradient($color, $color);
|
||||
background-color: lighten($color, 10%);
|
||||
&:before {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
.o_mrp_workorder_gantt .o_gantt_view .o_gantt_row_container .o_gantt_row .o_gantt_cell .o_gantt_pill_wrapper {
|
||||
div.o_gantt_pill.decoration-success {
|
||||
@include gantt-decoration-color($success);
|
||||
}
|
||||
div.o_gantt_pill.decoration-warning {
|
||||
@include gantt-decoration-color(gray('500'));
|
||||
}
|
||||
div.o_gantt_pill.decoration-danger {
|
||||
@include gantt-decoration-color($danger);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_bom_report.scss" />
|
||||
<link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_fields.scss" />
|
||||
<link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_gantt.scss" />
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -335,7 +335,13 @@
|
||||
<field name="name">mrp.production.work.order.gantt.production</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="arch" type="xml">
|
||||
<gantt date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" default_group_by="production_id" create="0">
|
||||
<gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" default_group_by="production_id" create="0"
|
||||
progress="progress" plan="0"
|
||||
decoration-danger="date_planned_start < current_date and state in ['pending', 'ready']"
|
||||
decoration-success="state == 'done'"
|
||||
decoration-warning="state == 'cancel'">
|
||||
<field name="date_planned_start"/>
|
||||
<field name="state"/>
|
||||
</gantt>
|
||||
</field>
|
||||
</record>
|
||||
@@ -344,7 +350,13 @@
|
||||
<field name="name">mrp.workorder.view.gantt</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="arch" type="xml">
|
||||
<gantt date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" default_group_by="workcenter_id" create="0">
|
||||
<gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" default_group_by="workcenter_id" create="0"
|
||||
progress="progress" plan="0"
|
||||
decoration-danger="date_planned_start < current_date and state in ['pending', 'ready']"
|
||||
decoration-success="state == 'done'"
|
||||
decoration-warning="state == 'cancel'">
|
||||
<field name="date_planned_start"/>
|
||||
<field name="state"/>
|
||||
</gantt>
|
||||
</field>
|
||||
</record>
|
||||
@@ -409,7 +421,7 @@
|
||||
<field name="view_mode">gantt,tree,form,calendar,pivot,graph</field>
|
||||
<field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/>
|
||||
<field name="view_id" ref="mrp_workorder_view_gantt"/>
|
||||
<field name="context">{'search_default_work_center': True}</field>
|
||||
<field name="context">{'search_default_work_center': True, 'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Start a new work order
|
||||
@@ -429,7 +441,7 @@
|
||||
<field name="view_mode">gantt,tree,form,calendar,pivot,graph</field>
|
||||
<field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/>
|
||||
<field name="view_id" ref="workcenter_line_gantt_production"/>
|
||||
<field name="context">{'search_default_production': True}</field>
|
||||
<field name="context">{'search_default_production': True, 'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Start a new work order
|
||||
@@ -447,7 +459,7 @@
|
||||
<field name="name">Work Orders</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.workorder</field>
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,gantt</field>
|
||||
<field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/>
|
||||
<field name="context">{'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field>
|
||||
<field name="help" type="html">
|
||||
|
||||
Reference in New Issue
Block a user