Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
3834 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Autor

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!

Autor Beste Antwort

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
Verwerfen
Beste Antwort

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
Verwerfen

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}}

Autor

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!

Verknüpfte Beiträge Antworten Ansichten Aktivität
2
März 25
6204
2
Feb. 24
8880
1
Juni 24
953
1
Jan. 19
5831
1
Okt. 18
3827