}
templ = MakoTemplate(message, input_encoding='utf-8')
reply = MakoTemplate(message).render_unicode(object=record, peobject=record, env=env, format_exceptions=True)
- return reply or False
+ if reply == 'False':
+ reply = ''
+ return reply
except Exception:
logging.exception("can't render %r", message)
return u""
_rec_name = 'subject'
_sql_constraints = []
+
email_message_common()
class email_message(osv.osv):
_description = 'Email Message'
_order = 'date desc'
+ def _check_email_recipients(self, cr, uid, ids, context=None):
+ '''
+ checks email_to, email_cc, email_bcc
+ '''
+ for message in self.browse(cr, uid, ids, context=context):
+ if not (message.email_to or message.email_cc or message.email_bcc):
+ return False
+ return True
+
+ _constraints = [
+ (_check_email_recipients, 'No recipients were specified. Please enter a recipient!', ['email_to', 'email_cc', 'email_bcc']),
+ ]
+
def open_document(self, cr, uid, ids, context=None):
""" To Open Document
@param self: The object pointer.