跳至内容
菜单
此问题已终结

In my company when creating a helpdesk ticket, in the field "customer" you have to put a customer that is registered in the contacts module as a company. I need to create a related field in odoo studio that allows me to select a contact from all the contacts that the company has registered. I have tried to do it through the domain configuration option but it does not work.

This is the domain I have registered but it does not give me the desired results.

[["parent_id.name","=","partner_id"]]



But if I edit it by putting the name of a company registered in my Odoo, then if it brings me the contacts of that company, something like that:

[["parent_id.name","=","Cliente Modelo, C.A."]].







形象
丢弃
最佳答案

Hi, 


There seems to be a bug but also a workaround. 

To create a dynamic domain, you need to 

1) You need to have 2 many-to-one fields. One for "Cliente" and one for "Contacto del Cliente". Both are using the "Contact" model.

2) Create your domain as you did but than you change it (in the black window below the fields) and you replace the double quotes with single quotes: 

[["parent_id","=","partner_id"]] shall be [['parent_id','=','x_studio_many2one_field_contact']]

=> note: x_studio_many2one_field_contact is the name of the field "Cliente"

3) Now, activate the debug mode and click on "View" (left - top) and on "XML". Now you need to locate your field in the right file. Once you located it, modify it from 

[['parent_id','=','x_studio_many2one_field_contact']] to domain="[['parent_id','=',x_studio_many2one_field_contact]]"(remove the single quotes only for x_studio_many2one_field_contact)


The domain should work now, but you will get an error if you try to modify the domain using the wizard. To modify the domain later on, you need to do it in the XML-view. 


Best regards, 


形象
丢弃
相关帖文 回复 查看 活动
1
1月 23
2703
1
10月 23
2371
0
3月 23
1228
0
2月 25
18
0
3月 24
1465