Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
4698 Tampilan

Dear all,

I'm very new to Odoo and I'd like to add a custom filter to the "New Helpdesk Ticket" form. I'd like the "Assigned to" form field only show users that are part of a specific group (Helpdesk Users) instead all the contacts list.

How can I do this?

Thank you!

Avatar
Buang
Jawaban Terbai

Hi,

You can achieve this through the UI, by enabling debug mode and going to Settings -> Technical -> Views. In the views, search for model helpdesk.

You'll find a view with type search and model helpdesk.team. Select that view

Add the necessary filter under the architecture and Save

Now the filter will be visible in the model.


Regards

Avatar
Buang
Penulis

Hello Cybrosys,
thank you for your answer, but I was not looking for such filters but to filter the list of items that are available for selection in a dropdown list field in a form. I cannot seem to be able to answer again my own question nor to add any picture in this comment, so I have added a new topic that I hope is explaining much better my problem: https://www.odoo.com/es_ES/forum/ayuda-1/filter-dropdown-items-shown-in-form-224751
Will you be interested in helping me solving my problem, please take a look at my new topic so that you can better understand my problem and hopefuly have a solution for it.
Thank you for your help!

Penulis Jawaban Terbai

Dear Jainesh,

thank you very much for your answer, but I have to admit I am not able to understand anything of the code you have attached... Where do I have to insert this code?

Also, I was hoping that this filter I need would be possible to be setup at the frontend, using the "Manage Filters" debug option for the "New Ticket" form.

Is it possible to add the filter I need using Odoo's "Manage Filters" integrated tool? If so, how can I do it?

Thank you!

Avatar
Buang
Jawaban Terbai

Hi Jordi Blanch,

You can write the below logic to get the specific group user in the dropdown

Please find code in comment. 

In the above change method, I get a list of users for the team_leader_id field. It gets only those users who have "group_team_lead" assigned. 

So based on(onchange of) department the system will bring the list of team leaders.

Hope it will be helpful to you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com 

Skype: kalpeshmaheshwari

Avatar
Buang

Please find code here :-

@api.onchange('department_id')
def onchange_department_id(self):
if self._context.get('onchange_dept'):
self.team_leader_id = False
if self.department_id:
user_ids = self.env.ref(
'training_management.group_team_lead').users.ids
partner_ids = self.env['res.users'].browse(user_ids).partner_id
if not self.department_id.all_dept:
partner_ids = partner_ids.filtered(
lambda partner: partner.department_id.id == \
self.department_id.id)
return {'domain': {'team_leader_id': [
('id', 'in', partner_ids.ids)]}}
return {'domain': {'team_leader_id': False}}

Penulis

Dear Jainesh,

thank you very much for your answer, but I have to admit I am not able to understand anything of the code you have attached... Where do I have to insert this code?

Also, I was hoping that this filter I need would be possible to be setup at the frontend, using the "Manage Filters" debug option for the "New Ticket" form.

Is it possible to add the filter I need using Odoo's "Manage Filters" integrated tool? If so, how can I do it?

Thank you!

Post Terkait Replies Tampilan Aktivitas
2
Mar 25
6879
Todays Filter Diselesaikan
2
Feb 24
9997
1
Jun 24
1419
1
Jan 19
6245
1
Okt 18
4295