Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
3877 Переглядів

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!

Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити
Автор

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!

Автор Найкраща відповідь

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!

Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити

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

Автор

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!

Related Posts Відповіді Переглядів Дія
2
бер. 25
6253
Todays Filter Вирішено
2
лют. 24
8954
1
черв. 24
983
1
січ. 19
5860
1
жовт. 18
3849