From 8f1d889e50e18d81db7d4e8bb0555513a2b1019c Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 13 Oct 2017 10:28:04 +0200 Subject: [PATCH] [FIX] tools: correctly export the non-module translations 8ac39287 introdcude a way to export the source terms not located inside an addons module (e.g. error messages in openerp/service/models.py) 0529a7f9 fixed a bug in the get_module_from_path with addons path with similar names. The above commit introduced a regression making files located outside of an addons path to be wrongly considered as a module e.g. openerp/service/models.py used not to match any module and was considered correctly as belonging to base module After, 0529a7f9, '~/openerp/service' being different than '~/openerp/service/' the module was considered as 'models.py' (which is incorrect). Compare correctly both parent path to have a correct match Fixes # 19907 --- openerp/tools/translate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py index 6929b31f954..886a87860b3 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -958,7 +958,8 @@ def trans_generate(lang, modules, cr): def get_module_from_path(path): for (mp, rec) in path_list: mp = os.path.join(mp, '') - if rec and path.startswith(mp) and os.path.dirname(path) != mp: + dirname = os.path.join(os.path.dirname(path), '') + if rec and path.startswith(mp) and dirname != mp: path = path[len(mp):] return path.split(os.path.sep)[0] return 'base' # files that are not in a module are considered as being in 'base' module