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