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