Skip to content

Commit

Permalink
[FIX] util/helpers: ensure non empty path
Browse files Browse the repository at this point in the history
Avoid issues if the caller pass a `None` object.

closes #106

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
  • Loading branch information
aj-fuentes committed Jul 5, 2024
1 parent 1d9e20e commit a05df66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/util/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ def resolve_model_fields_path(cr, model, path):
:return: resolved fields path parts
:rtype: list(:class:`~odoo.upgrade.util.helpers.FieldsPathPart`)
"""
if not path:
return []
path = list(path)
cr.execute(
"""
Expand Down
4 changes: 4 additions & 0 deletions src/util/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ def _remove_import_export_paths(cr, model, field=None):
"""
if field:
export_q = cr.mogrify(export_q + " WHERE el.name ~ %s ", [r"\y{}\y".format(field)]).decode()
else:
export_q += " WHERE el.name IS NOT NULL"

import_q = """
SELECT id,
Expand All @@ -501,6 +503,8 @@ def _remove_import_export_paths(cr, model, field=None):
"""
if field:
import_q = cr.mogrify(import_q + " WHERE field_name ~ %s ", [r"\y{}\y".format(field)]).decode()
else:
import_q += " WHERE field_name IS NOT NULL "

for query, impex_model in [(export_q, "ir.exports.line"), (import_q, "base_import.mapping")]:
cr.execute(query)
Expand Down

0 comments on commit a05df66

Please sign in to comment.