From 0529a7f9ba8daecdcf4df61557cebc55f549bb67 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 11 Jul 2016 18:07:05 +0200 Subject: [PATCH] [FIX] tools: extract terms in correct folder If two addons path have a common part in the folder name (e.g. `/home/alice/dev` and `/home/alice/devodoo`), the `get_module_from_path` method may match the wrong folder. A file `/home/alice/devodoo/bob/models.py` would wrongly match `/home/alice/dev` path (due to the lack of separator) and the returned module would be `odoo` (`"odoo/bob/models.py".split('/')[0]`). In such scenario, the translations of files (code, static folder, report) would not be included in the exported translation file. Force the module path to ends with a folder separator to avoid wrong matching. Closes #12757 --- 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 dffeba6e24f..34de366d56e 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -953,8 +953,9 @@ 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: - path = path[len(mp)+1:] + 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