Skip to Content
Menu
This question has been flagged
1 Reply
1324 Views

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?

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

Related Posts Replies Views Activity
1
Nov 24
177
3
Oct 24
750
0
Jun 21
1317
1
Sep 20
4986
1
Oct 15
6249