Merge pull request #276 from acsone/8.0-fix-transiflex-ape

[FIX][account_credit_control] Use HTML field instead of use a replace in the mail template - fix transiflex
This commit is contained in:
Guewen Baconnier
2015-09-29 10:45:06 +02:00
4 changed files with 81 additions and 49 deletions

View File

@@ -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',

View File

@@ -14,7 +14,7 @@
Dear ${object.contact_address.name or ''}
<br/>
<br/>
${object.current_policy_level.custom_mail_text.replace('\n', '<br>') | safe}
${object.current_policy_level.custom_mail_text | safe}
]]></field>
</record>
@@ -63,14 +63,15 @@ Thank you in advance for your anticipated cooperation in this matter.
Best regards
</field>
<field name="custom_mail_text">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
</field>
<field name="custom_mail_text"><![CDATA[
Our records indicate that we have not received the payment of the invoices mentioned in the attached document.<br/>
<br/>
If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.<br/>
<br/>
Thank you in advance for your anticipated cooperation in this matter.<br/>
<br/>
Best regards
]]></field>
</record>
<record model="credit.control.policy.level"
@@ -89,13 +90,14 @@ Thank you in advance for your anticipated cooperation in this matter.
Best regards
</field>
<field name="custom_mail_text">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
</field>
<field name="custom_mail_text"><![CDATA[
Our records indicate that we have not yet received the payment of the invoices mentioned in the attached document despite our first reminder.<br/>
If it has already been sent, please disregard this notice. If not, please proceed with payment within 5 days.<br/>
<br/>
Thank you in advance for your anticipated cooperation in this matter.<br/>
<br/>
Best regards
]]></field>
</record>
<record model="credit.control.policy.level"
@@ -120,17 +122,18 @@ Best regards
Best regards
</field>
<field name="custom_mail_text">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
</field>
<field name="custom_mail_text"><![CDATA[
Our records indicate that we still have not received the payment of the invoices mentioned in the attached document despite our two reminders.<br/>
If payment have already been sent, please disregard this notice. If not, please proceed with payment.<br/>
If your payment has not been received in the next 5 days, your file will be transfered to our debt collection agency.<br/>
<br/>
Should you need us to arrange a payment plan for you, please advise.<br/>
A customer account statement is enclosed for you convenience.<br/>
<br/>
Thank you in advance for your anticipated cooperation in this matter.<br/>
<br/>
Best regards
]]></field>
</record>
<!-- policy 2 -->
@@ -155,13 +158,14 @@ Best regards
Best regards
</field>
<field name="custom_mail_text">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
</field>
<field name="custom_mail_text"><![CDATA[
Our records indicate that we have not received the payment of the invoices mentioned in the attached document.<br/>
If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.<br/>
<br/>
Thank you in advance for your anticipated cooperation in this matter.<br/>
<br/>
Best regards
]]></field>
</record>
<record model="credit.control.policy.level"
@@ -186,19 +190,21 @@ Best regards
Best regards
</field>
<field name="custom_mail_text">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
</field>
<field name="custom_mail_text"><![CDATA[
Our records indicate that we still have not received the payment of the invoices mentioned in the attached document despite our reminder.
<br/>
<br/>
If payment have already been sent, please disregard this notice. If not, please proceed with payment.<br/>
If your payment has not been received in the next 5 days, your file will be transfered to our debt<br/>
collection agency.<br/>
<br/>
Should you need us to arrange a payment plan for you, please advise.<br/>
A customer account statement is enclosed for you convenience.<br/>
<br/>
Thank you in advance for your anticipated cooperation in this matter.<br/>
<br/>
Best regards
]]></field>
</record>
<record id="group_account_credit_control_manager" model="res.groups">

View 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)

View File

@@ -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',