Odoo Help

5

2
2 Answers
2
Avatar

Andreas Brueckl

--Andreas Brueckl--

5496
| 8 8 9
Vienna, النمسا
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
20‏/11‏/2013 11:50 ص

The reason for that is in located in the method fields_view_get_address in /addons/base/res/res_partner.py.

The partner views are dynamically changed based on the country of the current company. The tag <div class="address_format"> is replaced by one of the following values (depending on the address_format of the country):

    layouts = {
        '%(city)s %(state_code)s\n%(zip)s': """
            <div class="address_format">
                <field name="city" placeholder="City" style="width: 50%%"/>
                <field name="state_id" class="oe_no_button" placeholder="State" style="width: 47%%" options='{"no_open": true}'/>
                <br/>
                <field name="zip" placeholder="ZIP"/>
            </div>
        """,
        '%(zip)s %(city)s': """
            <div class="address_format">
                <field name="zip" placeholder="ZIP" style="width: 40%%"/>
                <field name="city" placeholder="City" style="width: 57%%"/>
                <br/>
                <field name="state_id" class="oe_no_button" placeholder="State" options='{"no_open": true}'/>
            </div>
        """,
        '%(city)s\n%(state_name)s\n%(zip)s': """
            <div class="address_format">
                <field name="city" placeholder="City"/>
                <field name="state_id" class="oe_no_button" placeholder="State" options='{"no_open": true}'/>
                <field name="zip" placeholder="ZIP"/>
            </div>
        """
    }

I suggest to disable this "feature" by applying one of the following methods:

  1. Override the function fields_view_get_address:

    class res_partner(osv.osv):
       _inherit ='res.partner'
       def fields_view_get_address(self, cr, uid, arch, context={}):
            return arch
    res_partner()
    
  2. Update the address_format in the country of your company:

    Goto menu "Sales/Configuration/Address Book/Localisation/Countries" and open the country of your company. Then you have to assure that the addess_format does not match one of the above formats. E.g. for Austria you can replace

    %(street)s
    %(street2)s
    %(city)s %(state_code)s %(zip)s
    %(country_name)s
    

with

    %(street)s
    %(street2)s
    %(city)s XXX %(state_code)s %(zip)s
    %(country_name)s
-1
Michael Yeung
2‏/11‏/2018 10:38 م

For the translation of Cities and States, you may apply two modules for them. However, they both do not support 7.0

base_address_city (11.0 / 12.0)
base_country_state_translatable (11.0 only for now)

1 Comment
twanda AG, Ermin Trevisan
3‏/11‏/2018 12:18 م

5 years later this answer is more than useless.

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now