تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
4641 أدوات العرض

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!

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 25
6861
Todays Filter تم الحل
2
فبراير 24
9950
1
يونيو 24
1404
1
يناير 19
6201
1
أكتوبر 18
4222