From a8469c45900ac4a463e1eb9d181ad34204b4b1bc Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 28 Aug 2018 11:03:32 +0200 Subject: [PATCH] [FIX] tools: handle code in po The previous code, as explained at b505ba9e0a, was to avoid creating duplicated code entries for the same source (as only one is considered). In case of a po comment like #. openerp-web #: model:ir.ui.view,arch_db:base.ir_access_view_search #: code:addons/web/static/src/js/chrome/search_inputs.js:716 #: code:addons/web/static/src/xml/base.xml:1125 #, python-format the condition was not triggered (trans_type is model), creating two code entries Necessary in #26614 to fix #26553 --- odoo/tools/translate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 182193bdaf7..e2d02ab040a 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -584,8 +584,11 @@ class PoFile(object): # end of this next() call), and keep the others to generate # additional entries (returned the next next() calls). trans_type, name, res_id = targets.pop(0) + code = False for t, n, r in targets: - if t == trans_type == 'code': continue + if t == 'code' and code: continue + if t == 'code': + code = True self.extra_lines.append((t, n, r, source, trad, comments)) if name is None: