From a69994b14435854281888eba0a77f61c8ad2a77f Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Mon, 17 Aug 2015 15:04:01 +0200 Subject: [PATCH 1/3] [FIX][account_credit_control] Use HTML field instead of use a replace in the mail template - fix transiflex --- account_credit_control/data.xml | 2 +- account_credit_control/policy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/account_credit_control/data.xml b/account_credit_control/data.xml index 3af588dea..25a1db130 100644 --- a/account_credit_control/data.xml +++ b/account_credit_control/data.xml @@ -14,7 +14,7 @@ Dear ${object.contact_address.name or ''}

- ${object.current_policy_level.custom_mail_text.replace('\n', '
') | safe} + ${object.current_policy_level.custom_mail_text | safe} ]]> diff --git a/account_credit_control/policy.py b/account_credit_control/policy.py index 0e2b03dfe..51bda55f2 100644 --- a/account_credit_control/policy.py +++ b/account_credit_control/policy.py @@ -239,7 +239,7 @@ class CreditControlPolicyLevel(models.Model): custom_text = fields.Text(string='Custom Message', required=True, translate=True) - custom_mail_text = fields.Text(string='Custom Mail Message', + custom_mail_text = fields.Html(string='Custom Mail Message', required=True, translate=True) _sql_constraint = [('unique level', From 12df164911439d67482c228d123952d91dfdde8e Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Wed, 23 Sep 2015 21:40:53 +0200 Subject: [PATCH 2/3] [ADD][account_credit_control] Add migration script for text field to html field change --- account_credit_control/__openerp__.py | 2 +- .../migrations/0.3/post-migration.py | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 account_credit_control/migrations/0.3/post-migration.py diff --git a/account_credit_control/__openerp__.py b/account_credit_control/__openerp__.py index 003486a41..4aca6c4b0 100644 --- a/account_credit_control/__openerp__.py +++ b/account_credit_control/__openerp__.py @@ -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', diff --git a/account_credit_control/migrations/0.3/post-migration.py b/account_credit_control/migrations/0.3/post-migration.py new file mode 100644 index 000000000..0bc929983 --- /dev/null +++ b/account_credit_control/migrations/0.3/post-migration.py @@ -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]', + '
','g')""") + cr.execute("""update ir_translation set + value=regexp_replace(value, E'[\\n]','
','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) From 6f8490ecdb3cce1a29476822d076ce04a4f61e2a Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Wed, 23 Sep 2015 22:07:36 +0200 Subject: [PATCH 3/3] [CHG][account_credit_control] Change policy level data according field text to html change --- account_credit_control/data.xml | 98 +++++++++++++++++---------------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/account_credit_control/data.xml b/account_credit_control/data.xml index 25a1db130..95ca87372 100644 --- a/account_credit_control/data.xml +++ b/account_credit_control/data.xml @@ -63,14 +63,15 @@ Thank you in advance for your anticipated cooperation in this matter. Best regards - Our records indicate that we have not received the payment of the invoices mentioned in the attached document. - -If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days. - -Thank you in advance for your anticipated cooperation in this matter. - -Best regards - + +
+ If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
- Our records indicate that we have not yet received the payment of the invoices mentioned in the attached document despite our first reminder. - If it has already been sent, please disregard this notice. If not, please proceed with payment within 5 days. - -Thank you in advance for your anticipated cooperation in this matter. - -Best regards - + + If it has already been sent, please disregard this notice. If not, please proceed with payment within 5 days.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
-Our records indicate that we still have not received the payment of the invoices mentioned in the attached document despite our two reminders. - If payment have already been sent, please disregard this notice. If not, please proceed with payment. - If your payment has not been received in the next 5 days, your file will be transfered to our debt collection agency. - - Should you need us to arrange a payment plan for you, please advise. - A customer account statement is enclosed for you convenience. - - Thank you in advance for your anticipated cooperation in this matter. - - Best regards - + + If payment have already been sent, please disregard this notice. If not, please proceed with payment.
+ If your payment has not been received in the next 5 days, your file will be transfered to our debt collection agency.
+
+ Should you need us to arrange a payment plan for you, please advise.
+ A customer account statement is enclosed for you convenience.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
@@ -155,13 +158,14 @@ Best regards Best regards - Our records indicate that we have not received the payment of the invoices mentioned in the attached document. -If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days. - -Thank you in advance for your anticipated cooperation in this matter. - -Best regards - + + If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
- Our records indicate that we still have not received the payment of the invoices mentioned in the attached document despite our reminder. - -If payment have already been sent, please disregard this notice. If not, please proceed with payment. -If your payment has not been received in the next 5 days, your file will be transfered to our debt - collection agency. - - Should you need us to arrange a payment plan for you, please advise. - A customer account statement is enclosed for you convenience. - - Thank you in advance for your anticipated cooperation in this matter. - - Best regards - + +
+ If payment have already been sent, please disregard this notice. If not, please proceed with payment.
+ If your payment has not been received in the next 5 days, your file will be transfered to our debt
+ collection agency.
+
+ Should you need us to arrange a payment plan for you, please advise.
+ A customer account statement is enclosed for you convenience.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>