# 1. Comment on pigs
compose_id = mail_compose.create(cr, uid,
- {'subject': 'Forget me subject', 'body': '<p>Dummy body</p>'},
+ {'subject': 'Forget me subject', 'body': '<p>Dummy body</p>', 'post': True},
{'default_composition_mode': 'comment',
'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
'default_template_id': email_template_id,
'active_ids': [self.group_pigs_id, self.group_bird_id]
}
- compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body'}, context)
+ compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body', 'post': True}, context)
compose = mail_compose.browse(cr, uid, compose_id, context)
onchange_res = compose.onchange_template_id(email_template_id, 'comment', 'mail.group', self.group_pigs_id)['value']
onchange_res['partner_ids'] = [(4, partner_id) for partner_id in onchange_res.pop('partner_ids', [])]
'default_partner_ids': [p_a_id],
'active_ids': [self.group_pigs_id, self.group_bird_id]
}
- compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body'}, context)
+ compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body', 'post': True}, context)
compose = mail_compose.browse(cr, uid, compose_id, context)
onchange_res = compose.onchange_template_id(email_template_id, 'mass_mail', 'mail.group', self.group_pigs_id)['value']
onchange_res['partner_ids'] = [(4, partner_id) for partner_id in onchange_res.pop('partner_ids', [])]
{
'subject': _subject,
'body': '${object.description}',
+ 'post': True,
'partner_ids': [(4, p_c_id), (4, p_d_id)],
}, context={
'default_composition_mode': 'mass_mail',
{
'subject': _subject,
'body': '${object.description}',
+ 'post': True,
'partner_ids': [(4, p_c_id), (4, p_d_id)],
}, context={
'default_composition_mode': 'mass_mail',
'body': lambda self, cr, uid, ctx={}: '',
'subject': lambda self, cr, uid, ctx={}: False,
'partner_ids': lambda self, cr, uid, ctx={}: [],
- 'post': lambda self, cr, uid, ctx={}: True,
- 'same_thread': lambda self, cr, uid, ctx={}: True,
+ 'post': False,
+ 'notify': False,
+ 'same_thread': True,
}
def check_access_rule(self, cr, uid, ids, operation, context=None):
<field name="parent_id" invisible="1"/>
<field name="mail_server_id" invisible="1"/>
<field name="use_active_domain" invisible="1"/>
- <field name="active_domain" invisible="1"/>
<!-- visible wizard -->
<field name="email_from"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
<field name="subject" placeholder="Subject..." required="True"/>
- <field name="post"
- attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
- <field name="notify"
- attrs="{'invisible':['|', ('post', '!=', True), ('composition_mode', '!=', 'mass_mail')]}"/>
- <field name="same_thread"
- attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
- <field name="reply_to" placeholder="Email address te redirect replies..."
- attrs="{'invisible':['|', ('same_thread', '=', True), ('composition_mode', '!=', 'mass_mail')],
- 'required':[('same_thread', '!=', True)]}"/>
+ <!-- classic message composer -->
<label for="partner_ids" string="Recipients"
attrs="{'invisible':[('composition_mode', '=', 'mass_mail')]}"/>
<div groups="base.group_user"
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
context="{'force_email':True, 'show_email':True}"/>
</div>
+ <!-- mass post / mass mailing -->
+ <field name="active_domain"
+ attrs="{'invisible': [('composition_mode', '!=', 'mass_mail')],
+ 'readonly': True}"/>
+ <field name="post"
+ attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
+ <field name="notify"
+ attrs="{'invisible':['|', ('post', '!=', True), ('composition_mode', '!=', 'mass_mail')]}"/>
+ <field name="same_thread"
+ attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
+ <field name="reply_to" placeholder="Email address te redirect replies..."
+ attrs="{'invisible':['|', ('same_thread', '=', True), ('composition_mode', '!=', 'mass_mail')],
+ 'required':[('same_thread', '!=', True)]}"/>
</group>
<field name="body"/>
<field name="attachment_ids" widget="many2many_binary" string="Attach a file"/>