Skip to content

[FIX] util/helpers: return on empty path #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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