I created a model for mentioning Email Group (x_egroup) and used that in a many2many field (x_group) in the Employee form (hr.employee)... When I mention the Email groups in the employee form, the employee names should be visible in the Email Group form....
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
Hi,
If you just need to see the selected employee in the email groups model, in the email groups form view, what you can do is that, add a many2many field with co model as hr.employee as follows:
Assuming the added many2many field in the hr.employee model is as follows,
x_group = fields.Many2many('x_egroup', 'relation_table_name', 'rel_1', 'rel_2', string='Email Group')
Then add an another many2many in the model x_egroup model as follows,
employee_ids = fields.Many2many('hr.employee', 'relation_table_name', 'rel_2', 'rel_1', string='Employees')
Just swap the rel_1 and rel_2, this will work for you.
Reference:
1. Working of Many2many fields in Odoo
Thanks
Thanks Niyas, for the answer, can you please tell me what would be rel_1, rel_2 ,are they any fields?
Hi,
You didn’t mention the Odoo version. If you are using Odoo studio, it may not work.
Add a One2many field employee_ids related to hr.employee in your custom model.
Then you can write an onchange function for the field x_group in hr.employee model to add employees into the field employee_ids.
Here you can understand about onchange method:
https://www.cybrosys.com/odoo-development-tutorial/v13/onchange-mechanism-api-onchange-odoo/
Hope it helps
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
0
يناير 21
|
2268 | ||
|
0
أغسطس 15
|
3661 | ||
|
1
أغسطس 25
|
3491 | ||
|
1
يوليو 25
|
578 | ||
|
5
مايو 25
|
17979 |
This will help you to customize odoo modules: https://sites.google.com/view/thinkincode/erp/odoo