feat: Se añade workflow a pending_task

This commit is contained in:
sinergia 2024-02-29 10:52:44 -05:00
parent 9096983ffd
commit b7e06a3408

View File

@ -1,11 +1,10 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, ModelView, fields
from trytond.model import Workflow, ModelSQL, ModelView, fields
from trytond.pyson import Eval
class PendingTask(ModelSQL, ModelView):
class PendingTask(Workflow, ModelSQL, ModelView):
'Tarea a realizar a un seguimiento de prospecto'
__name__ = "sale.pending_task"
@ -27,18 +26,21 @@ class PendingTask(ModelSQL, ModelView):
@classmethod
def __setup__(cls):
super(PendingTask, cls).__setup__()
cls._transitions |= set((
('pending', 'done'),
))
cls._buttons.update({
'close_task': {
'invisible': Eval('state') == 'done'
'invisible': ~Eval('state').in_(['pending']),
'depends':['state']
}
})
@classmethod
@ModelView.button
@Workflow.transition('done')
def close_task(cls, tasks):
for task in tasks:
task.state = 'done'
task.save()
pass
@classmethod
def default_state(cls):