Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
12412 มุมมอง

Hi guys

Where exactly can I modify the default behaviour that formats the address?
Currently when you create a customer and do not add a country it will print out the following structure:

But I want the ZIP code before the city.. So, where should I change the code so that the ZIP is printed in front of the city when no country is filled in?
res_partner.py seems to be responsible for the layout in the menu (https://github.com/odoo/odoo/blob/8.0/openerp/addons/base/res/res_partner.py#L61-77) but where can I modify it for all reports / everywhere at once?

Note: I do not want to configure this per country in the country list. It has to be set automaticly when a customer has no country filled in to ZIP address in place of adress ZIP.

With kind regards
Yenthe

อวตาร
ละทิ้ง

Maybe you can try: Setting -> Companies -> Your Company -> Edit -> Report configuration?

ผู้เขียน

Thanks for the suggestion Mathias. Are you talking about the RML header etc here? Sadly these fields are for V7 and no longer used in V8 since I use the QWeb reports.. So can't use this.

คำตอบที่ดีที่สุด

Address format is predefined in Country - go to Sales/Address Book/Localization/Countries

UPDATED:

or in res_partner.py, method  _display_address(...)

        # get the information that will be injected into the display format
        # get the address format
        address_format = address.country_id.address_format or \
              "%(street)s\n%(street2)s\n%(city)s %(state_code)s %(zip)s\n%(country_name)s"

 

 

 

อวตาร
ละทิ้ง
ผู้เขียน

Zbik I'm aware of that but there must be some Python code that fills up a default format because when you do not fill in a country it will still take the format City - ZIP and I want it to be ZIP - City. I'd like to change this logic if no country is filled in.

answer updated

ผู้เขียน

Thank you Zbik! Modifying the format in the display_address method did the job. Excellent answer as always :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 15
6628
0
มี.ค. 15
3886
14
พ.ค. 22
46918
How to make space in qweb report? แก้ไขแล้ว
8
มี.ค. 21
30612
0
มิ.ย. 17
4043