[MERGE] [FIX] mail: Chatter recipients display fixes.

bzr revid: tde@openerp.com-20130904114911-qbz31cu6675rt603
This commit is contained in:
Thibault Delavallée 2013-09-04 13:49:11 +02:00
commit e6b85985a5
6 changed files with 20 additions and 14 deletions

View File

@ -376,6 +376,7 @@ class mail_message(osv.Model):
'author_id': author,
'partner_ids': partner_ids,
'attachment_ids': attachment_ids,
'user_pid': pid
})
return True

View File

@ -53,6 +53,9 @@
.openerp .oe_mail > .oe_thread{
margin-left: 0px;
}
.openerp .oe_inline.oe_compose_recipients {
margin-top: -2px;
}
/* ---------------- MESSAGES ------------------ */

View File

@ -235,7 +235,7 @@ openerp.mail = function (session) {
this.attachment_ids = datasets.attachment_ids || [],
this.partner_ids = datasets.partner_ids || [];
this.date = datasets.date;
this.user_pid = datasets.user_pid || false;
this.format_data();
// update record_name: Partner profile
@ -565,6 +565,7 @@ openerp.mail = function (session) {
'default_partner_ids': partner_ids,
'mail_post_autofollow': true,
'mail_post_autofollow_partner_ids': partner_ids,
'is_private': self.is_private
};
if (self.is_log) {
_.extend(context, {'mail_compose_log': true});
@ -773,7 +774,7 @@ openerp.mail = function (session) {
// if clicked: call for suggested recipients
if (event.type == 'click') {
this.is_log = $input.hasClass('oe_compose_log');
suggested_partners = this.parent_thread.ds_thread.call('message_get_suggested_recipients', [[this.context.default_res_id]]).done(function (additional_recipients) {
suggested_partners = this.parent_thread.ds_thread.call('message_get_suggested_recipients', [[this.context.default_res_id], this.context]).done(function (additional_recipients) {
var thread_recipients = additional_recipients[self.context.default_res_id];
_.each(thread_recipients, function (recipient) {
var parsed_email = mail.ChatterUtils.parse_email(recipient[1]);
@ -1239,9 +1240,9 @@ openerp.mail = function (session) {
if (datasets.author_id && !_.contains(_.flatten(datasets.partner_ids),datasets.author_id[0]) && datasets.author_id[0]) {
datasets.partner_ids.push(datasets.author_id);
}
this.user_pid = datasets.user_pid || false;
this.partner_ids = datasets.partner_ids;
this.messages = [];
this.options.flat_mode = (this.options.display_indented_thread - this.thread_level > 0);
// object compose message

View File

@ -121,21 +121,23 @@
To:
<t t-if="!widget.is_private">
<span class="oe_all_follower">
<t t-if="widget.parent_thread.parent_message.record_name" t-raw="'&quot;' + widget.parent_thread.parent_message.record_name + '&quot;'">
<t t-if="widget.parent_thread.parent_message.record_name">
Followers of <t t-raw="'&quot;' + widget.parent_thread.parent_message.record_name + '&quot;'"/>
</t>
<t t-if="!widget.parent_thread.parent_message.record_name and widget.options.view_inbox">My Followers</t>
<t t-if="!widget.parent_thread.parent_message.record_name and !widget.options.view_inbox">Followers of this document</t>
</span>
</t>
<t t-if="!widget.is_private and (widget.partner_ids.length or (widget.author_id and widget.author_id[0]))"> and </t>
<t t-set="inc" t-value="0"/>
<t t-foreach="widget.partner_ids" t-as="partner">
<span t-attf-class="oe_partner_follower #{inc>=3?'oe_hidden':''}"><t t-if="inc" t-raw="', '"/>
<a t-if="widget.options.show_link" t-attf-href="#model=res.partner&amp;id=#{partner[0]}"><t t-raw="partner[1]"/></a>
<t t-if="!widget.options.show_link" t-raw="partner[1]"/>
</span>
<t t-set="inc" t-value="inc+1"/>
<t t-if="widget.is_private or (widget.user_pid != partner[0])">
<t t-if="!widget.is_private and inc==0"> and </t>
<span t-attf-class="oe_partner_follower #{inc>=3?'oe_hidden':''}"><t t-if="inc" t-raw="', '"/>
<a t-if="widget.options.show_link" t-attf-href="#model=res.partner&amp;id=#{partner[0]}"><t t-raw="partner[1]"/></a>
<t t-if="!widget.options.show_link" t-raw="partner[1]"/>
</span>
<t t-set="inc" t-value="inc+1"/>
</t>
</t>
<t t-if="widget.partner_ids.length > 3">
<span class="oe_more">, <a><t t-raw="widget.partner_ids.length - 3"/> others...</a></span>

View File

@ -66,7 +66,6 @@ class mail_compose_message(osv.TransientModel):
if context is None:
context = {}
result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)
# get some important values from context
composition_mode = context.get('default_composition_mode', context.get('mail.compose.message.mode'))
model = context.get('default_model', context.get('active_model'))
@ -78,7 +77,6 @@ class mail_compose_message(osv.TransientModel):
result['active_domain'] = '%s' % context.get('active_domain')
else:
result['active_domain'] = ''
# get default values according to the composition mode
if composition_mode == 'reply':
vals = self.get_message_data(cr, uid, message_id, context=context)
@ -212,7 +210,8 @@ class mail_compose_message(osv.TransientModel):
# get partner_ids from original message
partner_ids = [partner.id for partner in message_data.partner_ids] if message_data.partner_ids else []
partner_ids += context.get('default_partner_ids', [])
if context.get('is_private',False) and message_data.author_id : #check message is private then add author also in partner list.
partner_ids += [message_data.author_id.id]
# update the result
result = {
'record_name': message_data.record_name,

View File

@ -34,7 +34,7 @@
attrs="{'invisible':[('composition_mode', '=', 'mass_mail')]}">
<span attrs="{'invisible':[('model', '=', False)]}">
Followers of
<field name="record_name" readonly="1" class="oe_inline"/>
<field name="record_name" readonly="1" class="oe_inline oe_compose_recipients"/>
and
</span>
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."