[REM] mail: removed is_private on mail.message model. Updated models and widgets accordingly.
bzr revid: tde@openerp.com-20121017141933-uwbgqn041mvdtp7p
This commit is contained in:
parent
1fd3eadaad
commit
d24c21222e
|
@ -134,7 +134,6 @@ class mail_message(osv.Model):
|
|||
'subtype_id': fields.many2one('mail.message.subtype', 'Subtype'),
|
||||
'vote_user_ids': fields.many2many('res.users', 'mail_vote', 'message_id', 'user_id', string='Votes',
|
||||
help='Users that voted for this message'),
|
||||
'is_private': fields.boolean('Private message'),
|
||||
}
|
||||
|
||||
def _needaction_domain_get(self, cr, uid, context=None):
|
||||
|
@ -151,7 +150,6 @@ class mail_message(osv.Model):
|
|||
'date': lambda *a: fields.datetime.now(),
|
||||
'author_id': lambda self, cr, uid, ctx={}: self._get_default_author(cr, uid, ctx),
|
||||
'body': '',
|
||||
'is_private': True,
|
||||
}
|
||||
|
||||
#------------------------------------------------------
|
||||
|
@ -518,19 +516,17 @@ class mail_message(osv.Model):
|
|||
missing_notified = missing_notified
|
||||
if missing_notified:
|
||||
self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(4, p_id) for p_id in missing_notified]}, context=context)
|
||||
partners_to_notify |= extra_notified
|
||||
|
||||
def _notify(self, cr, uid, newid, context=None):
|
||||
""" Add the related record followers to the destination partner_ids if is not a private message.
|
||||
Call mail_notification.notify to manage the email sending
|
||||
"""
|
||||
message = self.browse(cr, uid, newid, context=context)
|
||||
if message and (message.is_private!=False and message.is_private!=None):
|
||||
if message and message.model and message.res_id:
|
||||
self._notify_followers(cr, uid, newid, message, context=context)
|
||||
|
||||
# add myself if I wrote on my wall,
|
||||
# unless remove myself author
|
||||
if ((message.model=="res.partner" and message.res_id==message.author_id.id)):
|
||||
|
||||
# add myself if I wrote on my wall, otherwise remove myself author
|
||||
if ((message.model == "res.partner" and message.res_id == message.author_id.id)):
|
||||
self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(4, message.author_id.id)]}, context=context)
|
||||
else:
|
||||
self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(3, message.author_id.id)]}, context=context)
|
||||
|
|
|
@ -683,12 +683,6 @@ class mail_thread(osv.AbstractModel):
|
|||
'subtype_id': subtype_id,
|
||||
})
|
||||
|
||||
# if the parent is private, the message must be private
|
||||
if parent_id:
|
||||
parent_message = mail_message.browse(cr, uid, parent_id, context=context)
|
||||
if parent_message.is_private:
|
||||
values["is_private"] = parent_message.is_private
|
||||
|
||||
# Avoid warnings about non-existing fields
|
||||
for x in ('from', 'to', 'cc'):
|
||||
values.pop(x, None)
|
||||
|
@ -697,6 +691,7 @@ class mail_thread(osv.AbstractModel):
|
|||
|
||||
def message_post_api(self, cr, uid, thread_id, body='', subject=False, type='notification',
|
||||
subtype=None, parent_id=False, attachments=None, context=None, **kwargs):
|
||||
# TDE FIXME: body is plaintext: convert it into html
|
||||
# when writing on res.partner, without specific thread_id -> redirect to the user's partner
|
||||
if self._name == 'res.partner' and not thread_id:
|
||||
thread_id = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
|
||||
|
|
|
@ -27,7 +27,6 @@ openerp.mail = function(session) {
|
|||
if( key!='default_template_id' &&
|
||||
key!='default_composition_mode' &&
|
||||
key!='default_use_template' &&
|
||||
key!='default_is_private' &&
|
||||
key!='default_model' &&
|
||||
key!='default_res_id' &&
|
||||
key!='default_subtype' &&
|
||||
|
@ -132,7 +131,6 @@ openerp.mail = function(session) {
|
|||
this.id = options.parameters.id;
|
||||
this.model = options.parameters.model;
|
||||
this.res_id = options.parameters.res_id;
|
||||
this.is_private = options.parameters.is_private;
|
||||
this.partner_ids = options.parameters.partner_ids;
|
||||
this.options={thread:{}};
|
||||
this.options.thread.show_header_compose = options.parameters.options.thread.show_header_compose;
|
||||
|
@ -345,7 +343,6 @@ openerp.mail = function(session) {
|
|||
'default_model': this.context.default_model,
|
||||
'default_res_id': this.context.default_res_id,
|
||||
'default_content_subtype': 'html',
|
||||
'default_is_private': true,
|
||||
'default_parent_id': this.id,
|
||||
'default_body': mail.ChatterUtils.get_text2html(this.$('textarea').val() || ''),
|
||||
'default_attachment_ids': attachments
|
||||
|
@ -832,7 +829,6 @@ openerp.mail = function(session) {
|
|||
this.id= param.id || false;
|
||||
this.model= param.model || false;
|
||||
this.parent_id= param.parent_id || false;
|
||||
this.is_private = param.is_private || false;
|
||||
this.author_id = param.author_id || false;
|
||||
this.partner_ids = [];
|
||||
for(var i in param.partner_ids){
|
||||
|
|
|
@ -95,8 +95,8 @@
|
|||
<t t-name="mail.thread.list_recipients">
|
||||
<div class="oe_mail_list_recipients">
|
||||
Post to:
|
||||
<span t-if="!widget.is_private" class="oe_all_follower">All Followers</span>
|
||||
<t t-if="!widget.is_private and widget.partner_ids.length"> and </t>
|
||||
<span t-if="widget.context.default_res_id and widget.context.default_res_id" class="oe_all_follower">All Followers</span>
|
||||
<t t-if="!widget.context.default_res_id and widget.context.default_res_id and widget.partner_ids.length"> and </t>
|
||||
<t t-set="inc" t-value="0"/>
|
||||
<t t-if="widget.partner_ids.length" 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-attf-href="#model=res.partner&id=#{partner[0]}"><t t-raw="partner[1]"/></a></span><t t-set="inc" t-value="inc+1"/>
|
||||
</t>
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
<field name="partner_ids" widget="many2many_tags" placeholder="Add contacts to notify..."
|
||||
context="{'force_email':True}"
|
||||
on_change="onchange_partner_ids(partner_ids)"/>
|
||||
<field name="is_private"
|
||||
help="If this message is not private, this message will send to all your followers or all followers of the parented message."/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Body">
|
||||
|
|
Loading…
Reference in New Issue