Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
98 Tampilan

I’m using Odoo Online, so I’m not sure if there’s much I can do to fix the issue. I took a screenshot, but unfortunately I can’t attach it here.


The ZIP code is appearing before the state, even though the XML code looks correct. I did try customizing the address layout earlier to better fit our needs, but we eventually reset everything back to default, and ever since then, the formatting has looked off.


Right now, the address displays as: street, street2, then on the third line it shows the city and ZIP code, with the state appearing slightly above and misaligned.


Is there anything I can do to correct this, or is this just a limitation of Odoo Online?


This is a snippet of the XML code

<div class="o_address_format" name="div_address">

                    <field name="street" placeholder="Street..." class="o_address_street"/>

                    <field name="street2" placeholder="Street 2..." class="o_address_street"/>

                    <field name="city" placeholder="City" class="o_address_city"/>

                    <field name="state_id" class="o_address_state" placeholder="State" options="{'no_open': True, 'no_quick_create': True}" context="{'country_id': country_id, 'default_country_id': country_id, 'zip': zip}"/>

                    <field name="zip" placeholder="ZIP" class="o_address_zip"/>

                    <field name="country_id" placeholder="Country" class="o_address_country" options="{&quot;no_open&quot;: True, &quot;no_create&quot;: True}"/>

                </div>

Avatar
Buang
Penulis Jawaban Terbai

Thanks for the response, that makes sense. In that case, it’s not a problem. I initially thought the code was affected because I noticed it changed around the zip and state, but that might have been due to testing with a different country input.


Also, I noticed that the address formatting looks a bit off specifically, the state appears slightly higher than the city and ZIP code. Do you happen to know why that might be happening? 

Avatar
Buang
Jawaban Terbai

Hi,


In Odoo (both Online and On-Premise), each country has its own address format configured under:

Settings → Contacts → Countries → [select country] → Address Format


This format defines whether ZIP comes before the state, or after. For example, in the US it’s “City, State ZIP”, while in some European formats it’s “ZIP City”. When you reset your XML, Odoo still applies the country’s format, which is why ZIP appears before the state.


Since you’re on Odoo Online, you cannot override the view with custom XML. Your only options are:


    Adjust the address format at country level (change the “Address Format” field for your country).


    If that’s not enough, use Odoo Studio to move the fields around on the form, but this won’t change how addresses are printed everywhere (like reports).



Hope it helps

Avatar
Buang