parent
a34917cce2
commit
64a5e86681
|
@ -415,6 +415,10 @@ msgctxt "selection:production.configuration,check_state_operation:"
|
|||
msgid "User Warning"
|
||||
msgstr "Alerta usuari"
|
||||
|
||||
msgctxt "selection:production.operation,state:"
|
||||
msgid "Canceled"
|
||||
msgstr "Cancel·lada"
|
||||
|
||||
msgctxt "selection:production.operation,state:"
|
||||
msgid "Done"
|
||||
msgstr "Realitzat"
|
||||
|
|
|
@ -416,6 +416,10 @@ msgctxt "selection:production.configuration,check_state_operation:"
|
|||
msgid "User Warning"
|
||||
msgstr "Alerta usuario"
|
||||
|
||||
msgctxt "selection:production.operation,state:"
|
||||
msgid "Canceled"
|
||||
msgstr "Cancelada"
|
||||
|
||||
msgctxt "selection:production.operation,state:"
|
||||
msgid "Done"
|
||||
msgstr "Realizado"
|
||||
|
|
13
operation.py
13
operation.py
|
@ -41,6 +41,7 @@ class Operation(sequence_ordered(), Workflow, ModelSQL, ModelView):
|
|||
operation_type = fields.Many2One('production.operation.type',
|
||||
'Operation Type', states=STATES, depends=DEPENDS, required=True)
|
||||
state = fields.Selection([
|
||||
('cancel', 'Canceled'),
|
||||
('planned', 'Planned'),
|
||||
('waiting', 'Waiting'),
|
||||
('running', 'Running'),
|
||||
|
@ -54,12 +55,16 @@ class Operation(sequence_ordered(), Workflow, ModelSQL, ModelView):
|
|||
super(Operation, cls).__setup__()
|
||||
cls._invalid_production_states_on_create = ['done']
|
||||
cls._transitions |= set((
|
||||
('planned', 'cancel'),
|
||||
('planned', 'waiting'),
|
||||
('waiting', 'running'),
|
||||
('running', 'waiting'),
|
||||
('running', 'done'),
|
||||
))
|
||||
cls._buttons.update({
|
||||
'cancel': {
|
||||
'invisible': Eval('state') != 'planned',
|
||||
},
|
||||
'wait': {
|
||||
'invisible': ~Eval('state').in_(['planned', 'running']),
|
||||
'icon': If(Eval('state') == 'running',
|
||||
|
@ -148,6 +153,12 @@ class Operation(sequence_ordered(), Workflow, ModelSQL, ModelView):
|
|||
self.work_center_category.uom)
|
||||
return total
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('cancel')
|
||||
def cancel(cls, operations):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('waiting')
|
||||
|
@ -300,7 +311,7 @@ class Production(metaclass=PoolMeta):
|
|||
if config.check_state_operation:
|
||||
pending_operations = Operation.search([
|
||||
('production', 'in', [p.id for p in productions]),
|
||||
('state', '!=', 'done'),
|
||||
('state', 'not in', ['cancel', 'done']),
|
||||
], limit=1)
|
||||
if pending_operations:
|
||||
operation, = pending_operations
|
||||
|
|
|
@ -95,6 +95,11 @@
|
|||
<field name="rule_group" ref="rule_group_production_operation"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="production_operation_cancel_button">
|
||||
<field name="name">cancel</field>
|
||||
<field name="string">Cancel</field>
|
||||
<field name="model" search="[('model', '=', 'production.operation')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button" id="production_operation_wait_button">
|
||||
<field name="name">wait</field>
|
||||
<field name="string">Wait</field>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
<group col="6" colspan="2" id="buttons">
|
||||
<button name="cancel" icon="tryton-cancel"/>
|
||||
<button name="wait"/>
|
||||
<button name="run" icon="tryton-forward"/>
|
||||
<button name="done" icon="tryton-forward"/>
|
||||
|
|
Loading…
Reference in New Issue