跳至内容
菜单
此问题已终结
1 回复
2474 查看

I am trying to super the function "retrieve_dashboard" found in the python file "helpdesk.py". This is to change the view from my tickets to all tickets inside the helpdesk overview. So, I modified the domain inside the function from the main code and it worked and now I want to super the function so that I can use it in my code. This is what I did: 


from odoo import api,fields,models,_
from odoo.osv import expression
class HelpDeskTeamInh(models.Model):
_inherit = 'helpdesk.team'
@api.model
def retrieve_dashboard(self):
domain = [('user_id', '!=', self.env.uid)]
res=super(HelpDeskTeamInh, self).retrieve_dashboard()
group_fields = ['priority', 'create_date', 'stage_id', 'close_hours']
list_fields = ['priority', 'create_date', 'stage_id', 'close_hours']
# TODO: remove SLA calculations if user_uses_sla is false.
user_uses_sla = self.user_has_groups('helpdesk.group_use_sla') and \
bool(self.env['helpdesk.team'].search(
[('use_sla', '=', True), '|', ('member_ids', 'in', self._uid), ('member_ids', '=', False)]))
if user_uses_sla:
group_fields.insert(1, 'sla_deadline:year')
group_fields.insert(2, 'sla_deadline:hour')
group_fields.insert(3, 'sla_reached_late')
list_fields.insert(1, 'sla_deadline')
list_fields.insert(2, 'sla_reached_late')
HelpdeskTicket = self.env['helpdesk.ticket']
tickets = HelpdeskTicket.search_read(expression.AND([domain, [('stage_id.is_close', '=', False)]]),
['sla_deadline', 'open_hours', 'sla_reached_late', 'priority'])
result = {
'helpdesk_target_closed': self.env.user.helpdesk_target_closed,
'helpdesk_target_rating': self.env.user.helpdesk_target_rating,
'helpdesk_target_success': self.env.user.helpdesk_target_success,
'today': {'count': 0, 'rating': 0, 'success': 0},
'7days': {'count': 0, 'rating': 0, 'success': 0},
'my_all': {'count': 0, 'hours': 0, 'failed': 0},
'my_high': {'count': 0, 'hours': 0, 'failed': 0},
'my_urgent': {'count': 0, 'hours': 0, 'failed': 0},
'show_demo': not bool(HelpdeskTicket.search([], limit=1)),
'rating_enable': False,
'success_rate_enable': user_uses_sla
}
return res

Any Help Please?

形象
丢弃
最佳答案

res=super(HelpDeskTeamInh, self).retrieve_dashboard() first add this after this domain = [('user_id', '!=', self.env.uid)] at the end return res make sure all you do is in between them

形象
丢弃
编写者

Yes, but this is done in the piece of code I provided above and no changes were applied.

相关帖文 回复 查看 活动
1
11月 24
1894
3
4月 25
2772
0
6月 21
2213
1
9月 20
6498
1
10月 15
7051