Skip to Content
Menu
This question has been flagged
4 Replies
2639 Views

Hello, currently the order of the adres of our customers are displayed in the wrong order. On the invoice and in the contactlist. How do I change this? Example: currently we have House number, Street, City, Postal code. But in the netherlands we have the order Street, house number, postal code and city. 

Avatar
Discard
Best Answer

You install contacts module. Go to settings in this module. Find menu Country, select Netherlands and change order in field  Layout in Reports.

Avatar
Discard
Author

I am editing the Netherlands now, but can not find the Layout in reports? Do you perhaps have a screenshot?

You activate the developer mode.

Best Answer

In res.partner object , there is an method which create the string of the address of partner . Override below method in your res.partner object as per your expected format.


@api.model
def _get_default_address_format(self):
return "%(street)s\n%(street2)s\n%(state_code)s\t%(zip)s\t%(city)s\n%(country_name)s"

Avatar
Discard
Author

Were can I find res.partner object ?

Well, It is base module : base/res/res_partner.py file.

To override the method you have inherit the object res.partner in your custom module and override above method.

e.g

#create file

custome_res_partner.py

#Insert following code :

# -*- coding: utf-8 -*-

from odoo import api, fields, models, tools, SUPERUSER_ID, _

class ResPartner(models.Model):

_description = 'Contact'

_inherit = 'res.partner'

@api.model

def _get_default_address_format(self):

return "%(street)s\n%(street2)s\n%(state_code)s\t%(zip)s\t%(city)s\n%(country_name)s"