This question has been flagged
3 Replies
5018 Views

For example in Contacts module there are Street, Street 2, City, State, ZIP and Country fields. I want to add a Street 3 in the address. So my scenario is I will create a customer in CRM then I will create a quotation for that customer. I want the Street 3 will always show in the address (Example when I view the quotation or customer preview the shipping address will also show the street 3).

My problem: I created a custom field then add that field in res.partner.form but when I view a quotation or in customer preview my custom field does not show.

Avatar
Discard

See this to customize odoo modules: https://goo.gl/8HgnCF

Hi Paresh,

If you view a quotation there is a field/link Customer and it has the name of customer and below is its address. It is not a usual field It is a widget so it is hard or even impossible to include a custom field.

In customer view, you cannot use the developer mode even if it is activated.

That is why I want to add a custom field in address so whenever the address used in different module the custom field always included?

I don't need to force to achieve it I just want to know if that is possible or if it is possible but I need to modify a lot in code.

Another challenge is that I don't customized directly in odoo source code instead I use separate repository and used that by odoo community. I'm using Odoo.sh that is why.

Thanks!

Hi Renz: Please see the additional information I have added to my earlier response based on the clarification you provided. Hope this helps.

Best Answer

Hi Renz: 

You will also need to add the new field (Street 3) to the views on which the Quotation and Customer preview forms are based for it to be displayed there.

EDIT (based on your clarification):

The res_partner_many2one widget gets the information from the list of address fields which is hard coded in the base code which is located here (for rel 13):

https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/models/res_partner.py#L31

If you are familiar with how to customize the Odoo code you can extend the Partner class listed here and override the ​ _address_fields method to add your custom field to the list so that it gets picked up across the system. The ​ _address_fields method is located at the following line in the same script.

https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/models/res_partner.py#L397

 

Avatar
Discard