Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2106 Vistas

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.

Avatar
Descartar
Mejor respuesta

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

Avatar
Descartar
Mejor respuesta

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

Avatar
Descartar
Autor

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

Publicaciones relacionadas Respuestas Vistas Actividad
1
feb 25
980
1
oct 23
1461
1
mar 23
4577
2
nov 20
3298
2
nov 20
7939