[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
This commit is contained in:
Martin Trigaux
2018-08-28 18:10:03 +02:00
parent fe9cd11ab5
commit a8469c4590
+4 -1
View File
@@ -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: