mirror of
https://github.com/NaN-tic/trytond-project_helpdesk.git
synced 2023-12-14 05:32:56 +01:00
Set default tracker only for helpdesk tasks.
This commit is contained in:
parent
7459e60ca5
commit
ae0c460b31
2 changed files with 9 additions and 4 deletions
8
work.py
8
work.py
|
@ -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
|
||||
|
|
5
work.xml
5
work.xml
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue