Set default tracker only for helpdesk tasks.

This commit is contained in:
Albert Cervera i Areny 2014-05-12 18:03:40 +02:00
parent 7459e60ca5
commit ae0c460b31
2 changed files with 9 additions and 4 deletions

View file

@ -3,6 +3,7 @@
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval, Not, Bool
from trytond.transaction import Transaction
__all__ = ['Work', 'WorkType']
__metaclass__ = PoolMeta
@ -28,9 +29,10 @@ class Work:
@staticmethod
def default_tracker():
Tracker = Pool().get('project.work.tracker')
tracker = Tracker.search([('helpdesk', '=', True)])
return tracker and tracker[0].id
if Transaction().context.get('helpdesk'):
Tracker = Pool().get('project.work.tracker')
tracker = Tracker.search([('helpdesk', '=', True)])
return tracker and tracker[0].id
def on_change_with_helpdesk(self, name=None):
return self.tracker.helpdesk if self.tracker else None

View file

@ -22,7 +22,7 @@
<field name="type">form</field>
<field name="name">work_helpdesk_form</field>
</record>
<record model="ir.ui.view" id="project_tracker_view_form">
<field name="model">project.work.tracker</field>
<field name="inherit" ref="project_tracker.project_tracker_view_form"/>
@ -55,6 +55,7 @@
<field name="name">Helpdesk</field>
<field name="res_model">project.work</field>
<field name="domain">[('parent', '=', None),('helpdesk', '=', True)]</field>
<field name="context">{'helpdesk': True}</field>
</record>
<record model="ir.action.act_window.view"
id="act_project_helpdesk_tree_view1">
@ -75,6 +76,7 @@
<field name="name">Projects</field>
<field name="res_model">project.work</field>
<field name="domain">[('type', '=', 'project'),('helpdesk', '=', True)]</field>
<field name="context">{'helpdesk': True}</field>
</record>
<record model="ir.action.act_window.view"
id="act_project_helpdesk_form_view1">
@ -95,6 +97,7 @@
<field name="name">Tasks</field>
<field name="res_model">project.work</field>
<field name="domain">[('type', '=', 'task'),('helpdesk', '=', True)]</field>
<field name="context">{'helpdesk': True}</field>
</record>
<record model="ir.action.act_window.view"
id="act_task_helpdesk_form_view1">