[FIX] [IMP] Second batch of fixes and small usability fixes/improvements for CRM...
authorThibault Delavallée <tde@openerp.com>
Wed, 13 Mar 2013 13:13:41 +0000 (14:13 +0100)
committerThibault Delavallée <tde@openerp.com>
Wed, 13 Mar 2013 13:13:41 +0000 (14:13 +0100)
email_template:
- fix email_template overriding recipients even when the template is void; the convention is that void values in the template are not used, meaning that they are not relevant in the template and not that they should erase existing values,
- added _order on name on email_template, in order to ease the choosing of templates,
crm:
- fix phonecall scheduling taking the lead/opportunity description as phonecall description,
- fix phonecall scheduling Chatter message: added phonecall description into it
- improved phonecall scheduling wizard form view (type is now on the left to ease reading and updating),
- fix opt_out parameter explanations; this parameter is relevant only for mass mailing and marketing campaigns,
- added 'Available for mass mailing' (opt_out = False) filter to give users the possibility of filtering leads before performing mass mailing,
res_partner:
- fix notification_email_send field missing on res_partner form view, preventing management of email reception policy for partners,
- fix opt_out parameter explanations (field added in email_template); this parameter is relevant only for mass mailing and marketing campaigns,
- added 'Available for mass mailing' (opt_out = False) filter to give users the possibility of filtering leads before performing mass mailing,
mail_message:
- fix read/unread filters on mail_message (help of both filters were the same; string of Unread becomes To Read to be clearer)

bzr revid: tde@openerp.com-20130313131341-5pwn4g0nmbaq030p

1  2 
addons/mail/mail_mail.py

@@@ -191,20 -192,34 +191,31 @@@ class mail_mail(osv.Model)
          return body
  
      def send_get_mail_reply_to(self, cr, uid, mail, partner=None, context=None):
--        """ Return a specific ir_email body. The main purpose of this method
--            is to be inherited by Portal, to add a link for signing in, in
--            each notification email a partner receives.
++        """ Return a specific ir_email reply_to.
  
              :param browse_record mail: mail.mail browse_record
              :param browse_record partner: specific recipient partner
          """
 -        # TDE FIXME BEFORE MERGE: not sure the late change is interesting
          if mail.reply_to:
              return mail.reply_to
-         if not mail.model or not mail.res_id:
-             return False
-         if not hasattr(self.pool.get(mail.model), 'message_get_reply_to'):
-             return False
-         return self.pool.get(mail.model).message_get_reply_to(cr, uid, [mail.res_id], context=context)[0]
+         email_reply_to = False
+         # if model and res_id: try to use ``message_get_reply_to`` that returns the document alias
+         if mail.model and mail.res_id and hasattr(self.pool.get(mail.model), 'message_get_reply_to'):
+             email_reply_to = self.pool.get(mail.model).message_get_reply_to(cr, uid, [mail.res_id], context=context)[0]
+         # no alias reply_to -> reply_to will be the email_from, only the email part
+         if not email_reply_to and mail.email_from:
+             emails = tools.email_split(mail.email_from)
+             if emails:
+                 email_reply_to = emails[0]
+         # format 'Document name <email_address>'
+         if email_reply_to and mail.model and mail.res_id:
+             document_name = self.pool.get(mail.model).name_get(cr, SUPERUSER_ID, [mail.res_id], context=context)[0]
+             if document_name:
+                 email_reply_to = _('Followers of %s <%s>') % (document_name[1], email_reply_to)
+         return email_reply_to
  
      def send_get_email_dict(self, cr, uid, mail, partner=None, context=None):
          """ Return a dictionary for specific email values, depending on a