Skip to content

Commit

Permalink
Merge pull request #372 from Tecnativa/imp-convert_field_to_html
Browse files Browse the repository at this point in the history
[IMP] convert_field_to_html: pre-clean empty values
  • Loading branch information
pedrobaeza authored Jun 14, 2024
2 parents 5646c07 + a05a740 commit 2ab632b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,14 @@ def convert_field_to_html(cr, table, field_name, html_field_name, verbose=True):
"You cannot use this method in an OpenUpgrade version prior to 7.0."
)
return
# Pre-clean empty values
cr.execute( # pylint: disable=E8103
"UPDATE %(table)s SET %(field)s = NULL WHERE %(field)s = ''"
% {
"field": field_name,
"table": table,
}
)
cr.execute( # pylint: disable=E8103
"SELECT id, %(field)s FROM %(table)s WHERE %(field)s IS NOT NULL"
% {
Expand Down

0 comments on commit 2ab632b

Please sign in to comment.