+
@@ -107,7 +106,7 @@
For an SMS Text Message, internal Title of the Message.
-
+
{'readonly': [('state', 'in', ('sending', 'done'))], 'invisible': [('mailing_type', '!=', 'mail')]}
@@ -123,7 +122,7 @@
-
+
@@ -151,6 +150,16 @@
{'invisible': [('mailing_type', '!=', 'mail')]}
+ {'invisible': ['|', ('mailing_type', '!=', 'mail'),
+ ('mail_server_available', '=', False)], 'readonly': [('state', 'in', ('sending', 'done'))]}
+
+
+ {'invisible': [('mailing_type', '!=', 'mail')]}
+
+
+ {'invisible': [('mailing_type', '!=', 'mail')]}
+
+
{'invisible': [('mailing_type', '!=', 'mail')]}
diff --git a/odoo/addons/base/tests/test_mail.py b/odoo/addons/base/tests/test_mail.py
index 71ad194c371..ff92a840a2b 100644
--- a/odoo/addons/base/tests/test_mail.py
+++ b/odoo/addons/base/tests/test_mail.py
@@ -328,11 +328,13 @@ class TestHtmlTools(BaseCase):
for content in void_strings_samples:
self.assertTrue(is_html_empty(content))
- void_html_samples = ['
', '
', '
']
+ void_html_samples = ['
', '
', '
', '
',
+ '
']
for content in void_html_samples:
self.assertTrue(is_html_empty(content), 'Failed with %s' % content)
- valid_html_samples = ['
1
', '
1
']
+ valid_html_samples = ['
1
', '
1
', '
Hello World
',
+ '
']
for content in valid_html_samples:
self.assertFalse(is_html_empty(content))
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py
index 223f2bb9eb9..bbc8a660451 100644
--- a/odoo/tools/mail.py
+++ b/odoo/tools/mail.py
@@ -270,16 +270,16 @@ def validate_url(url):
def is_html_empty(html_content):
- """Check if a html content is empty. If there are only formatting tags or
- a void content return True. Famous use case if a '
' added by
- some web editor.
+ """Check if a html content is empty. If there are only formatting tags with style
+ attributes or a void content return True. Famous use case if a
+ '
' added by some web editor.
:param str html_content: html content, coming from example from an HTML field
:returns: bool, True if no content found or if containing only void formatting tags
"""
if not html_content:
return True
- tag_re = re.compile(r'\<\s*\/?(?:p|div|span|br|b|i)\s*/?\s*\>')
+ tag_re = re.compile(r'\<\s*\/?(?:p|div|span|br|b|i)\s*(?:style=\".+\")?/?\s*\>')
return not bool(re.sub(tag_re, '', html_content).strip())