[FIX] mail: for mass mailing, replies in document False by default
authorDenis Ledoux <dle@openerp.com>
Thu, 30 Jan 2014 10:20:01 +0000 (11:20 +0100)
committerDenis Ledoux <dle@openerp.com>
Thu, 30 Jan 2014 10:20:01 +0000 (11:20 +0100)
Post a copy in the document is False by default, and it does not make sense to replies in the document if the copy is not itself in the document.
Therefore, if post a copy in the document is false by default, replies in the document should be false too.

Moreover, reply_to is required in the form view if mass mailing mode and post a copy is false OR replies in the document is false
But, to avoid updating the view, in the send_mail python function, if no reply to is set and post a copy or replies is false, we set the from email as the reply_to email

bzr revid: dle@openerp.com-20140130102001-v4t8ig1sj3cpfy3b

addons/mail/wizard/mail_compose_message.py
addons/mail/wizard/mail_compose_message_view.xml

index 74aea3d..50e8a84 100644 (file)
@@ -138,7 +138,7 @@ class mail_compose_message(osv.TransientModel):
         'partner_ids': lambda self, cr, uid, ctx={}: [],
         'post': False,
         'notify': False,
-        'same_thread': True,
+        'same_thread': False,
     }
 
     def check_access_rule(self, cr, uid, ids, operation, context=None):
@@ -268,6 +268,8 @@ class mail_compose_message(osv.TransientModel):
                         'mail.message', 0,
                         context=context)
                     mail_values['attachment_ids'] = m2m_attachment_ids
+                    if not mail_values.get('reply_to'):
+                        mail_values['reply_to'] = mail_values['email_from']
                     self.pool.get('mail.mail').create(cr, uid, mail_values, context=context)
                 else:
                     subtype = 'mail.mt_comment'
index 948d9b3..2393164 100644 (file)
                         <field name="notify"
                             attrs="{'invisible':['|', ('post', '!=', True), ('composition_mode', '!=', 'mass_mail')]}"/>
                         <field name="same_thread"
-                            attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
+                            attrs="{'invisible':['|', ('composition_mode', '!=', 'mass_mail'), ('post', '=', False)]}"/>
                         <field name="reply_to" placeholder="Email address te redirect replies..."
-                            attrs="{'invisible':['|', ('same_thread', '=', True), ('composition_mode', '!=', 'mass_mail')],
-                                    'required':[('same_thread', '!=', True)]}"/>
+                            attrs="{'invisible':['|', '&amp;', ('same_thread', '=', True), ('post', '=', True), ('composition_mode', '!=', 'mass_mail')],
+                                    'required':['&amp;', '|', ('post', '=', False), ('same_thread', '=', False), ('composition_mode', '=', 'mass_mail')]}"/>
                     </group>
                     <field name="body"/>
                     <field name="attachment_ids" widget="many2many_binary" string="Attach a file"/>