From 825dcb242b0f4539bdefe4a0251d11be64aabf0a Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 29 Sep 2020 09:37:19 +0000 Subject: [PATCH] [FIX] base_address_extended: Wrong street format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Create a german contact C with street1 = 'Istanbulstraße 22-26' - Install base_address_extended - Go to C and edit it Bug: 'Istanbulstraße' was displayed in the number of the street PS: A post init hook is needed otherwise the default street_format '%(street_number)s/%(street_number2)s %(street_name)s' was always used. opw:2320385 closes odoo/odoo#58905 X-original-commit: a97d981b9dd96b0066e09d763eff10a6ca70819c Signed-off-by: Simon Goffin (sig) --- addons/base_address_extended/__init__.py | 6 ++++++ addons/base_address_extended/__manifest__.py | 1 + .../data/base_address_extended_data.xml | 3 +++ 3 files changed, 10 insertions(+) diff --git a/addons/base_address_extended/__init__.py b/addons/base_address_extended/__init__.py index dc5e6b693d1..53f55eeff98 100644 --- a/addons/base_address_extended/__init__.py +++ b/addons/base_address_extended/__init__.py @@ -2,3 +2,9 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import models +from odoo import api, SUPERUSER_ID + + +def _update_street_format(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + env['res.partner'].search([])._compute_street_data() diff --git a/addons/base_address_extended/__manifest__.py b/addons/base_address_extended/__manifest__.py index a28394c756d..890bf2cfc62 100644 --- a/addons/base_address_extended/__manifest__.py +++ b/addons/base_address_extended/__manifest__.py @@ -20,4 +20,5 @@ with the street name, the house number, and room number. 'data/base_address_extended_data.xml', ], 'depends': ['base'], + 'post_init_hook': '_update_street_format', } diff --git a/addons/base_address_extended/data/base_address_extended_data.xml b/addons/base_address_extended/data/base_address_extended_data.xml index ae25025fee2..35b4f584e67 100644 --- a/addons/base_address_extended/data/base_address_extended_data.xml +++ b/addons/base_address_extended/data/base_address_extended_data.xml @@ -1,6 +1,9 @@ + + +