跳至内容
菜单
此问题已终结
2 回复
2122 查看

Hello All,


I am looking for tips on how to replicate the VAT/EIN/TaxID field behavior for other fields I have created on res.partner model with Studio.


When a partner has Children, the VAT can only be entered on the Parent Contact, and then the VAT cascades down and is shown on all the Children.


I have a need for the same behavior on customer partner fields I have created with Studio.


The same cascade behavior is observed on the "Company ID" field on a partner, however that field goes invisible on children instead of readonly but still visible.

形象
丢弃
最佳答案

Hi,

To replicate the behavior of the VAT field on a new field created via Studio, you'll need to implement a compute function for your field while ensuring that it has the correct field dependencies.

The VAT field in Odoo typically utilizes a widget called 'field_partner_autocomplete' and may involve a separate module that extends the 'res.partner' model, often named 'partner_autocomplete'. These files can be referenced within the Odoo addons directory to understand better how the VAT functionality is implemented and integrated into the system. Studying these files can provide valuable insights into replicating similar behavior for your custom field.


Hope it helps

形象
丢弃
最佳答案

I think you will need to add code for that. Try to replicate the behavior using compute fields in Odoo Studio when you add a field and click on `More` you would be able to put the code for the compute field, fields dependencies and everything referring to the others fields in the model or through relationship fields

形象
丢弃
编写者

Hello Axel. Yes I think this is where it needs to happen. The question I guess if if the compute code entered there will be enough to fire from onchange events for that field. For instance I know EIN field has some other onchange code written on the base module itself for res_partner.py file.

If anyone can point us in the right direction for code to test would be greatly appreciated.

Using the proper fields dependencies the answer is should be enough

相关帖文 回复 查看 活动
1
2月 25
985
1
10月 23
1465
1
3月 23
4581
2
11月 20
3306
2
11月 20
7944