[MERGE] Post 'mail-cleaning-fp merge' fixes
- fixed wrong parameters and var names changed during refactoring - basically fixed message_post calling message_fetch with weird values; however, the reload will be fixed in another branch - fixed related record links - fixed Chatter on a document not using message_ids field value - removed dead CSS code - pre is now displayed using the usual OpenERP fonts - fixed issue with user avatars - res_users: added a hook so that already existing users follow themselves when installing Social - fixed security rule based on follower_ids, that is now message_follower_ids bzr revid: tde@openerp.com-20120910091621-v4n2el4qz2de49d5
This commit is contained in:
commit
6694b79196
|
@ -55,9 +55,20 @@ class res_users(osv.Model):
|
|||
return init_res
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
"""Installation hook to create aliases for all users and avoid constraint errors."""
|
||||
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users,self)._auto_init,
|
||||
""" Installation hook: aliases, partner following themselves """
|
||||
# create aliases for all users and avoid constraint errors
|
||||
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init,
|
||||
self._columns['alias_id'], 'login', alias_force_key='id', context=context)
|
||||
# make already existing users follow themselves, using SQL to avoid using the ORM during the auto_init
|
||||
cr.execute(""" SELECT p.id FROM res_partner p
|
||||
LEFT JOIN mail_followers n
|
||||
ON (n.partner_id = p.id AND n.res_model = 'res.partner' AND n.res_id = p.id)
|
||||
WHERE n.id IS NULL
|
||||
""")
|
||||
params = [(res[0], res[0]) for res in cr.fetchall()]
|
||||
cr.executemany(""" INSERT INTO mail_followers (partner_id, res_model, res_id)
|
||||
VALUES (%s, 'res.partner', %s)
|
||||
""", params)
|
||||
|
||||
def create(self, cr, uid, data, context=None):
|
||||
# create default alias same as the login
|
||||
|
|
|
@ -322,11 +322,7 @@
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_subtitle {
|
||||
margin: 0 0 .5em 0;
|
||||
}
|
||||
.openerp .oe_mail_msg_footer,
|
||||
.openerp .oe_mail_msg_subtitle {
|
||||
.openerp .oe_mail_msg_footer {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
|
@ -340,12 +336,13 @@
|
|||
text-align: justify;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_msg_body span.oe_mail_msg_tail {
|
||||
display: inline;
|
||||
.openerp .oe_mail_msg_record_body pre {
|
||||
font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.openerp .oe_mail_oe_bold {
|
||||
font-weight: bold;
|
||||
.openerp .oe_mail_msg_body span.oe_mail_msg_tail {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Read more/less link */
|
||||
|
|
|
@ -411,7 +411,7 @@ openerp.mail = function(session) {
|
|||
self.thread = new mail.Thread(self, {
|
||||
'context': {
|
||||
'default_model': record.model,
|
||||
'default_id': record.res_id,
|
||||
'default_res_id': record.res_id,
|
||||
'default_parent_id': record.id },
|
||||
'message_data': record.child_ids, 'thread_level': self.options.thread_level-1,
|
||||
'show_header_compose': false, 'show_reply': self.options.thread_level > 1,
|
||||
|
@ -473,7 +473,7 @@ openerp.mail = function(session) {
|
|||
},
|
||||
|
||||
display_user_avatar: function () {
|
||||
var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', this.options.uid);
|
||||
var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', this.session.uid);
|
||||
return this.$el.find('img.oe_mail_icon').attr('src', avatar);
|
||||
},
|
||||
|
||||
|
@ -484,9 +484,9 @@ openerp.mail = function(session) {
|
|||
var body = comment_node.val();
|
||||
comment_node.val('');
|
||||
}
|
||||
return this.ds_post.call('message_post', [
|
||||
[this.options.context.res_id], body, false, 'comment', this.options.context.parent_id]
|
||||
).then(this.proxy('message_fetch'));
|
||||
return this.ds_thread.call('message_post', [
|
||||
[this.options.context.default_res_id], body, false, 'comment', this.options.context.default_parent_id, undefined]
|
||||
).then(self.message_fetch());
|
||||
},
|
||||
|
||||
/** Action: 'shows more' to fetch new messages */
|
||||
|
@ -585,6 +585,7 @@ openerp.mail = function(session) {
|
|||
var thread = new mail.Thread(self, {
|
||||
'context': this.options.context,
|
||||
'thread_level': this.options.thread_level, 'show_header_compose': true,
|
||||
'message_ids': this.get_value(),
|
||||
'show_delete': true, 'composer': true });
|
||||
this.thread_list.push(thread);
|
||||
return thread.appendTo(this.$el.find('div.oe_mail_recthread_main'));
|
||||
|
|
|
@ -118,15 +118,14 @@
|
|||
<t t-raw="record.subject"/>
|
||||
</h1>
|
||||
<div class="oe_mail_msg_body">
|
||||
|
||||
<div class="oe_mail_msg_record_body">
|
||||
<a t-attf-href="#model=#{params.res_model}&id=#{params.res_id}" t-if="(params.thread_level > 0) & (!record.subject)"><t t-raw="record.record_name"/></a>
|
||||
<a t-attf-href="#model=#{record.model}&id=#{record.res_id}" t-if="(params.thread_level > 0) & (!record.subject)"><t t-raw="record.record_name"/></a>
|
||||
<t t-raw="record.body"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_clear"/>
|
||||
<ul class="oe_mail_msg_footer">
|
||||
<li t-if="record.subject & params.thread_level > 0"><a t-attf-href="#model=#{params.res_model}&id=#{params.res_id}"><t t-raw="record.record_name"/></a></li>
|
||||
<li t-if="record.subject & params.thread_level > 0"><a t-attf-href="#model=#{record.model}&id=#{record.res_id}"><t t-raw="record.record_name"/></a></li>
|
||||
<li><a t-attf-href="#model=res.partner&id=#{record.author_id[0]}"><t t-raw="record.author_id[1]"/></a></li>
|
||||
<li><span t-att-title="record.date"><t t-raw="record.timerelative"/></span></li>
|
||||
<li t-if="display['show_reply']"><a href="#" class="oe_mail_msg_reply">Reply</a></li>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<field name="name">public Members</field>
|
||||
<field name="model_id" ref="model_project_project"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|','|',('privacy_visibility','in',[False,'public']),('members','in',[user.id]),('follower_ids','in',[user.partner_id.id])]</field>
|
||||
<field name="domain_force">['|','|',('privacy_visibility','in',[False,'public']),('members','in',[user.id]),('message_follower_ids','in',[user.partner_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="task_comp_rule">
|
||||
|
|
Loading…
Reference in New Issue