[IMP] mrp: added mass start stop on workorders
This commit add a mass start and stop buttons that allows to start or stop multiple workorder at the same time. Starting a workorder checks if the user needs to be logged and if the workorder is not blocked. This commit also change the appearance of the mark as done button task id : 3216277 Part-of: odoo/odoo#114901
This commit is contained in:
@@ -880,3 +880,14 @@ class MrpWorkorder(models.Model):
|
||||
wo.duration = wo.duration_expected
|
||||
wo.duration_percent = 100
|
||||
wo.state = 'done'
|
||||
|
||||
def action_mass_start(self):
|
||||
for wo in self:
|
||||
if wo.working_state == 'blocked':
|
||||
raise UserError(_('Some workorders require another workorder to be completed first'))
|
||||
for wo in self:
|
||||
wo.button_start()
|
||||
|
||||
def action_mass_pause(self):
|
||||
for wo in self:
|
||||
wo.button_pending()
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" multi_edit="1">
|
||||
<header>
|
||||
<button name="action_mark_as_done" type="object" string="Mark as done" class="btn-outline-primary"/>
|
||||
<button name="action_mass_start" type="object" string="Start" class="btn btn-success text-uppercase"/>
|
||||
<button name="action_mass_pause" type="object" string="Pause" class="btn btn-warning text-uppercase"/>
|
||||
<button name="action_mark_as_done" type="object" string="Done" class="btn btn-danger text-uppercase"/>
|
||||
</header>
|
||||
<field name="consumption" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
|
||||
Reference in New Issue
Block a user