Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
696 Tampilan

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
Buang
Jawaban Terbai

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
Buang

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>

Penulis

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

Post Terkait Replies Tampilan Aktivitas
2
Okt 24
2737
1
Mei 25
1347
1
Mar 25
1523
MERGING CONTACTS Diselesaikan
1
Feb 25
2315
2
Feb 25
2666