Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2173 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 25
996
1
thg 10 23
1493
1
thg 3 23
4646
Editing Fields Đã xử lý
2
thg 11 20
3343
Editing Fields Đã xử lý
2
thg 11 20
7994