Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
669 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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>

Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 24
2722
1
thg 5 25
1266
1
thg 3 25
1461
MERGING CONTACTS Đã xử lý
1
thg 2 25
2077
Use of external id Đã xử lý
2
thg 2 25
2574