Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
692 Ansichten

I’m currently working in Odoo Contacts and would like to create an address field in a specific format, but I haven’t been able to do so.

The version I try to achieve is:

Customer:  ​Company Name

​Street

​postal code, Region

​country


Originally, there was a field like this available in the Contacts module, but I accidentally deleted it. Unfortunately, the predefined fields such as “Complete Address” or “Inlined Complete Address” do not match the format I need.

Could you please help me create a custom address field that meets the desired format?

Avatar
Verwerfen
Beste Antwort

Hi Elvira Brown,


I hope you're doing well.

Regarding your request to recreate a custom address field in the specific format below:


// Code in Comment//


Image - 

Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Avatar
Verwerfen

Code :

<record id="view_for_address_form" model="ir.ui.view">
<field name="name">res.partner.address.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//span[@name='address_name']" position="replace">
<span class="o_form_label o_td_label o_address_type" name="address_name">
<span invisible="is_company">Custom for Address Name for Person</span>
<span invisible="not is_company">Custom Address Name for company</span>
</span>
</xpath>

<xpath expr="//div[@class='o_address_format']" position="replace">
<div class="o_address_format">
<field name="street" placeholder="Street..." class="o_address_street"/>
<field name="zip" placeholder="Postal code" class="o_address_zip"/>
<field name="state_id" placeholder="Region" class="o_address_state"
options="{'no_open': True, 'no_quick_create': True}"
context="{'country_id': country_id, 'default_country_id': country_id, 'zip': zip}"/>
<div name="partner_address_country" class="d-flex justify-content-between">
<field name="country_id" placeholder="Country" class="o_address_country"
options="{&quot;no_open&quot;: True, &quot;no_create&quot;: True}"/>
</div>
</div>
</xpath>
</field>
</record>

Autor

Thank you very much, Jainesh. Could you please provide more detailed information on where exactly I should insert this code?

Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Okt. 24
2730
1
Mai 25
1344
1
März 25
1523
1
Feb. 25
2291
2
Feb. 25
2661