mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[ADD][account_credit_control] Add migration script for text field to html field change
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
{'name': 'Account Credit Control',
|
||||
'version': '0.2.0',
|
||||
'version': '0.3.0',
|
||||
'author': "Camptocamp,Odoo Community Association (OCA)",
|
||||
'maintainer': 'Camptocamp',
|
||||
'category': 'Finance',
|
||||
|
||||
26
account_credit_control/migrations/0.3/post-migration.py
Normal file
26
account_credit_control/migrations/0.3/post-migration.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
import logging
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.modules.registry import RegistryManager
|
||||
|
||||
uid = SUPERUSER_ID
|
||||
|
||||
__name__ = 'Change custom_mail_text text field to hmtl field'
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate_replace_text_with_html(cr, registry):
|
||||
cr.execute("""update credit_control_policy_level set
|
||||
custom_mail_text=regexp_replace(custom_mail_text, E'[\\n]',
|
||||
'<br/>','g')""")
|
||||
cr.execute("""update ir_translation set
|
||||
value=regexp_replace(value, E'[\\n]','<br/>','g')
|
||||
where name='credit.control.policy.level,custom_mail_text'""")
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
# it is the installation of the module
|
||||
return
|
||||
registry = RegistryManager.get(cr.dbname)
|
||||
migrate_replace_text_with_html(cr, registry)
|
||||
Reference in New Issue
Block a user