diff --git a/account_payment_mode/__init__.py b/account_payment_mode/__init__.py index 548c73eb1a1..0650744f6bc 100644 --- a/account_payment_mode/__init__.py +++ b/account_payment_mode/__init__.py @@ -1,2 +1 @@ -from .hooks import pre_init_hook from . import models diff --git a/account_payment_mode/hooks.py b/account_payment_mode/hooks.py deleted file mode 100644 index 217bd989614..00000000000 --- a/account_payment_mode/hooks.py +++ /dev/null @@ -1,34 +0,0 @@ -import logging - -from odoo.tools import sql -from odoo.tools.mail import plaintext2html - -logger = logging.getLogger(__name__) - - -def pre_init_hook(cr): - """Adapt note field to HTML if already exists""" - if sql.column_exists(cr, "account_payment_mode", "note"): - field_name = "note" - table = "account_payment_mode" - # 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" - % { - "field": field_name, - "table": table, - } - ) - for row in cr.fetchall(): - query = "UPDATE %(table)s SET %(field)s = %%s WHERE id = %%s" % { - "field": field_name, - "table": table, - } - cr.execute(query, (plaintext2html(row[1]), row[0]))