[IMP] mail: add message 'Add this contact's email on recipient and follower'

bzr revid: chm@openerp.com-20121221111400-ngc62hepbgzqepy8
This commit is contained in:
Christophe Matthieu
2012-12-21 12:14:00 +01:00
parent 9fe900791d
commit f080e91168
3 changed files with 12 additions and 9 deletions
+5 -6
View File
@@ -774,18 +774,17 @@ class mail_thread(osv.AbstractModel):
new_partner_ids = set([])
for partner in extra_email:
part_ids = self.pool.get('res.partner').search(cr, uid, [('email', '=', partner)], context=context)
# create a new partner if not exists
if not part_ids:
part_ids = [self.pool.get('res.partner').name_create(cr, uid, partner, context=dict())[0]]
new_partner_ids |= set(part_ids)
self.message_subscribe(cr, uid, [thread_id], part_ids, context=context)
# link mail with this from mail to the new partner id
message_ids = mail_message.search(cr, uid, [('email_from', '=', partner)], context=context)
if part_ids and message_ids:
mail_message.write(cr, uid, message_ids, {'email_from': None, 'author_id': part_ids[0]}, context=context)
new_partner_ids |= set(part_ids)
if new_partner_ids:
self.message_subscribe(cr, uid, new_partner_ids, part_ids, context=context)
partner_ids = set(kwargs.pop('partner_ids', [])) | set(new_partner_ids)
@@ -846,7 +845,7 @@ class mail_thread(osv.AbstractModel):
self.check_access_rights(cr, uid, 'read')
else:
self.check_access_rights(cr, uid, 'write')
self.write(cr, SUPERUSER_ID, ids, {'message_follower_ids': [(4, pid) for pid in partner_ids]}, context=context)
# if subtypes are not specified (and not set to a void list), fetch default ones
if subtype_ids is None:
+4 -1
View File
@@ -253,10 +253,13 @@
.openerp .oe_mail .oe_msg_composer .oe_msg_attachment_list{
display: block;
}
.openerp .oe_mail .oe_msg_composer .oe_emails_from{
font-size: 12px;
}
.openerp .oe_mail .oe_msg_composer .oe_emails_from label{
vertical-align: middle;
display: block;
line-height: 16px;
line-height: 14px;
}
.openerp .oe_mail .oe_msg_composer .oe_emails_from input{
vertical-align: middle;
+3 -2
View File
@@ -113,8 +113,8 @@
<t t-if="!widget.parent_thread.parent_message.record_name">this document</t>
</span>
</t>
<t t-if="!widget.is_private and (widget.partner_ids.length || widget.author_id)"> and </t>
<t t-if="widget.author_id">
<t t-if="!widget.is_private and (widget.partner_ids.length or (widget.author_id and widget.author_id[0]))"> and </t>
<t t-if="widget.author_id and widget.author_id[0]">
<a t-if="widget.options.show_link and widget.author_id[0]" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}"><t t-raw="widget.author_id[1]"/></a>
<span t-if="(!widget.options.show_link or !widget.author_id[0])"><t t-raw="widget.author_id[1]"/></span>
<t t-if="widget.partner_ids.length" t-raw="', '"/>
@@ -132,6 +132,7 @@
</t>
</div>
<div class="oe_emails_from" t-if="widget.emails_from.length">
Add this contact's email on recipient and follower :
<t t-foreach='widget.emails_from' t-as='email_from'>
<label><input type="checkbox" t-att-checked="email_from[1] ? 'checked' : undefind" t-att-data="email_from[0]"/> <t t-raw="email_from[0]"/></label>
</t>