[IMP] mrp: kanban view, see working user
This commit add an icon for each people that worked on the Wo and also a play icon if the WO is in progress a pause icon if the WO's workcenter is blocked.
This commit is contained in:
@@ -117,8 +117,10 @@ class MrpWorkorder(models.Model):
|
||||
time_ids = fields.One2many(
|
||||
'mrp.workcenter.productivity', 'workorder_id')
|
||||
is_user_working = fields.Boolean(
|
||||
'Is the Current User Working', compute='_compute_is_user_working',
|
||||
'Is the Current User Working', compute='_compute_working_users',
|
||||
help="Technical field indicating whether the current user is working. ")
|
||||
working_user_ids = fields.One2many('res.users', string='Working user on this work order.', compute='_compute_working_users')
|
||||
last_working_user_id = fields.One2many('res.users', string='Last user that worked on this work order.', compute='_compute_working_users')
|
||||
production_messages = fields.Html('Workorder Message', compute='_compute_production_messages')
|
||||
|
||||
next_work_order_id = fields.Many2one('mrp.workorder', "Next Work Order")
|
||||
@@ -149,9 +151,14 @@ class MrpWorkorder(models.Model):
|
||||
else:
|
||||
self.duration_percent = 0
|
||||
|
||||
def _compute_is_user_working(self):
|
||||
""" Checks whether the current user is working """
|
||||
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:
|
||||
order.working_user_ids = [(4, order.id) for order in order.time_ids.filtered(lambda time: not time.date_end).sorted('date_start').mapped('user_id')]
|
||||
if order.working_user_ids:
|
||||
order.last_working_user_id = order.working_user_ids[-1]
|
||||
elif order.time_ids:
|
||||
order.last_working_user_id = order.time_ids.sorted('date_end')[-1].user_id
|
||||
if order.time_ids.filtered(lambda x: (x.user_id.id == self.env.user.id) and (not x.date_end) and (x.loss_type in ('productive', 'performance'))):
|
||||
order.is_user_working = True
|
||||
else:
|
||||
|
||||
@@ -328,6 +328,10 @@
|
||||
<field name="name"/>
|
||||
<field name="production_id"/>
|
||||
<field name="state"/>
|
||||
<field name="is_user_working"/>
|
||||
<field name="working_user_ids"/>
|
||||
<field name="last_working_user_id"/>
|
||||
<field name="working_state"/>
|
||||
<field name="workcenter_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="qty_production"/>
|
||||
@@ -336,13 +340,22 @@
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
|
||||
<div class="oe_kanban_content">
|
||||
<strong><span><t t-esc="record.production_id.value"/></span> - <span><t t-esc="record.name.value"/></span></strong>
|
||||
<div class="row">
|
||||
<div class="col-xs-7 o_kanban_primary_left">
|
||||
<span><t t-esc="record.product_id.value"/></span>
|
||||
<div>
|
||||
<strong class="o_kanban_record_title">
|
||||
<span><t t-esc="record.production_id.value"/></span> - <span><t t-esc="record.name.value"/></span>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
<span><t t-esc="record.product_id.value"/></span> <span><t t-esc="record.qty_production.value"/> <t t-esc="record.product_uom_id.value"/></span>
|
||||
</div>
|
||||
<div class="col-xs-5 o_kanban_primary_right">
|
||||
<span><t t-esc="record.qty_production.value"/> <t t-esc="record.product_uom_id.value"/></span>
|
||||
<div class="oe_kanban_bottom_right" t-if="record.state.raw_value == 'progress'">
|
||||
<span t-if="record.working_state.raw_value != 'blocked' and record.working_user_ids.raw_value.length > 0"><i class="fa fa-play"/></span>
|
||||
<span t-if="record.working_state.raw_value != 'blocked' and record.working_user_ids.raw_value.length == 0 and record.last_working_user_id.raw_value"><i class="fa fa-pause"/></span>
|
||||
<span t-if="record.working_state.raw_value == 'blocked' and (record.working_user_ids.raw_value.length == 0 or record.last_working_user_id.raw_value)"><i class="fa fa-stop"/></span>
|
||||
<t t-if="record.last_working_user_id.raw_value">
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', record.last_working_user_id.raw_value)" width="24" height="24" class="oe_kanban_avatar"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user