Compare commits

...

2 Commits

2 changed files with 16 additions and 9 deletions

View File

@ -21,7 +21,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_call_tree"> <record model="ir.action.act_window" id="act_call_tree">
<field name="name">Calls</field> <field name="name">Calls</field>
<field name="res_model">sale.call</field> <field name="res_model">sale.call</field>
<field name="domain"
eval="[('operator_who_called', '=', Eval('_user'))]" pyson="1"/>
</record> </record>
<record model="ir.ui.view" id="call_view_tree"> <record model="ir.ui.view" id="call_view_tree">
<field name="model">sale.call</field> <field name="model">sale.call</field>
@ -77,7 +79,10 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_pending_task_tree"> <record model="ir.action.act_window" id="act_pending_task_tree">
<field name="name">Pending tasks</field> <field name="name">Pending tasks</field>
<field name="res_model">sale.pending_task</field> <field name="res_model">sale.pending_task</field>
<field name="domain"
eval="[If(Eval('context', {}).get('user_admin', None), (), ('prospect_trace.prospect_assigned_operator', '=', Eval('_user')))]"
pyson="1"/>
</record> </record>
<record model="ir.ui.view" id="pending_task_view_tree"> <record model="ir.ui.view" id="pending_task_view_tree">
<field name="model">sale.pending_task</field> <field name="model">sale.pending_task</field>

View File

@ -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):