Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
4617 Widoki

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!

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
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 Najlepsza odpowiedź

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!

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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!

Powiązane posty Odpowiedzi Widoki Czynność
2
mar 25
6851
Todays Filter Rozwiązane
2
lut 24
9935
1
cze 24
1397
1
sty 19
6193
1
paź 18
4219