Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
694 Переглядів

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?

Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити

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>

Автор

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

Related Posts Відповіді Переглядів Дія
2
жовт. 24
2730
1
трав. 25
1344
1
бер. 25
1523
MERGING CONTACTS Вирішено
1
лют. 25
2300
Use of external id Вирішено
2
лют. 25
2664