Allow to choose by configuration if a production will be done with the

last operation done.
This commit is contained in:
Bernat Brunet 2022-10-06 13:57:13 +02:00 committed by Raimon Esteve
parent 1daa711ede
commit 7bdf72ad28
5 changed files with 29 additions and 1 deletions

View File

@ -12,7 +12,13 @@ class Configuration(metaclass=PoolMeta):
('user_error', 'User Error'),
], 'Check State Operation',
help='Check state operation when done a production')
allow_done_production = fields.Boolean('Allow Done Produciton',
help='Allow done the productoin when finish the last operation')
@staticmethod
def default_check_state_operation():
return 'user_error'
@staticmethod
def default_allow_done_production():
return True

View File

@ -14,6 +14,10 @@ msgctxt "field:production.configuration,check_state_operation:"
msgid "Check State Operation"
msgstr "Comprovar estat operació"
msgctxt "field:production.configuration,allow_done_production:"
msgid "Allow Done Produciton"
msgstr "Permetre realitzar producció"
msgctxt "field:production.operation,company:"
msgid "Company"
msgstr "Empresa"
@ -130,6 +134,10 @@ msgctxt "help:production.configuration,check_state_operation:"
msgid "Check state operation when done a production"
msgstr "Comprova l'estat de les operacions quan es finalitza una producció"
msgctxt "help:production.configuration,allow_done_production:"
msgid "Allow done the productoin when finish the last operation"
msgstr "Permentre finalitzar la producció quan es finalitza l'última operació"
msgctxt "model:ir.action,name:"
msgid "Operation Type"
msgstr "Tipus d'operació"

View File

@ -14,6 +14,10 @@ msgctxt "field:production.configuration,check_state_operation:"
msgid "Check State Operation"
msgstr "Comprobar estado operación"
msgctxt "field:production.configuration,allow_done_production:"
msgid "Allow Done Produciton"
msgstr "Permitir realizar producción"
msgctxt "field:production.operation,company:"
msgid "Company"
msgstr "Empresa"
@ -131,6 +135,11 @@ msgid "Check state operation when done a production"
msgstr ""
"Comprueba el estado de las operaciones cuando se finaliza una producción"
msgctxt "help:production.configuration,allow_done_production:"
msgid "Allow done the productoin when finish the last operation"
msgstr ""
"Permitir finalizar la producción cuando se finaliza la última operación"
msgctxt "model:ir.action,name:"
msgid "Operation Type"
msgstr "Tipo de operación"

View File

@ -189,6 +189,8 @@ class Operation(sequence_ordered(), Workflow, ModelSQL, ModelView):
def done(cls, operations):
pool = Pool()
Production = pool.get('production')
Config = pool.get('production.configuration')
config = Config(1)
productions = set([o.production for o in operations])
cls.write(operations, {'state': 'done'})
@ -201,7 +203,8 @@ class Operation(sequence_ordered(), Workflow, ModelSQL, ModelView):
break
if to_do:
to_done.append(production)
Production.done(to_done)
if config.allow_done_production:
Production.done(to_done)
class OperationTracking(ModelSQL, ModelView):

View File

@ -6,5 +6,7 @@
<newline/>
<label name="check_state_operation"/>
<field name="check_state_operation"/>
<label name="allow_done_production"/>
<field name="allow_done_production"/>
</xpath>
</data>