[FIX] Chatter: fixed posting on user/partner. Cleaned a bit default options of mail.js.
bzr revid: tde@openerp.com-20121115095400-u7h6rw8ltp0xprtt
This commit is contained in:
parent
71c2be227c
commit
25c684b171
|
@ -7,7 +7,7 @@
|
|||
<field name="res_model">mail.message</field>
|
||||
<field name="context">{
|
||||
'default_model': 'res.users',
|
||||
'default_res_id': uid
|
||||
'default_res_id': uid,
|
||||
}</field>
|
||||
<field name="params" eval=""{
|
||||
'domain': [
|
||||
|
|
|
@ -57,7 +57,8 @@ class res_partner_mail(osv.Model):
|
|||
if thread_id not in partner_ids:
|
||||
partner_ids.append(thread_id)
|
||||
kwargs['partner_ids'] = partner_ids
|
||||
return super(res_partner_mail, self).message_post(cr, uid, False, body=body, subject=subject,
|
||||
thread_id = False
|
||||
return super(res_partner_mail, self).message_post(cr, uid, thread_id, body=body, subject=subject,
|
||||
type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, **kwargs)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -113,7 +113,8 @@ class res_users(osv.Model):
|
|||
alias_pool.unlink(cr, uid, alias_ids, context=context)
|
||||
return res
|
||||
|
||||
def message_post_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, attachment_ids=None, context=None):
|
||||
def message_post_user_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False,
|
||||
attachment_ids=None, context=None, content_subtype='plaintext', **kwargs):
|
||||
""" Redirect the posting of message on res.users to the related partner.
|
||||
This is done because when giving the context of Chatter on the
|
||||
various mailboxes, we do not have access to the current partner_id.
|
||||
|
@ -124,8 +125,8 @@ class res_users(osv.Model):
|
|||
if isinstance(thread_id, (list, tuple)):
|
||||
thread_id = thread_id[0]
|
||||
partner_id = self.pool.get('res.users').read(cr, uid, thread_id, ['partner_id'], context=context)['partner_id'][0]
|
||||
return self.pool.get('res.partner').message_post_api(cr, uid, partner_id, body=body, subject=subject,
|
||||
parent_id=parent_id, attachment_ids=attachment_ids, context=context)
|
||||
return self.pool.get('res.partner').message_post_user_api(cr, uid, partner_id, body=body, subject=subject,
|
||||
parent_id=parent_id, attachment_ids=attachment_ids, context=context, content_subtype=content_subtype, **kwargs)
|
||||
|
||||
def message_post(self, cr, uid, thread_id, context=None, **kwargs):
|
||||
""" Redirect the posting of message on res.users to the related partner.
|
||||
|
@ -140,10 +141,6 @@ class res_users(osv.Model):
|
|||
partner_id = self.pool.get('res.users').read(cr, uid, thread_id, ['partner_id'], context=context)['partner_id'][0]
|
||||
return self.pool.get('res.partner').message_post(cr, uid, partner_id, context=context, **kwargs)
|
||||
|
||||
def message_update(self, cr, uid, ids, msg_dict, update_vals=None, context=None):
|
||||
partner_id = self.pool.get('res.users').browse(cr, uid, ids)[0].partner_id.id
|
||||
return self.pool.get('res.partner').message_update(cr, uid, [partner_id], msg_dict,
|
||||
update_vals=update_vals, context=context)
|
||||
|
||||
class res_users_mail_group(osv.Model):
|
||||
""" Update of res.users class
|
||||
|
|
|
@ -24,7 +24,7 @@ openerp.mail = function (session) {
|
|||
*/
|
||||
var context_keys = ['default_template_id', 'default_composition_mode',
|
||||
'default_use_template', 'default_partner_ids', 'default_model',
|
||||
'default_res_id', 'default_content_subtype', , 'default_subject',
|
||||
'default_res_id', 'default_content_subtype', 'default_subject',
|
||||
'default_body', 'active_id', 'lang', 'bin_raw', 'tz',
|
||||
'active_model', 'edi_web_url_view', 'active_ids',
|
||||
'default_attachment_ids']
|
||||
|
@ -521,8 +521,6 @@ openerp.mail = function (session) {
|
|||
on_compose_fullmail: function (default_composition_mode) {
|
||||
if (default_composition_mode == 'reply') {
|
||||
var context = {
|
||||
'default_model': this.context.default_model,
|
||||
'default_res_id': this.context.default_res_id,
|
||||
'default_composition_mode': default_composition_mode,
|
||||
'default_parent_id': this.id,
|
||||
'default_body': mail.ChatterUtils.get_text2html(this.$el ? (this.$el.find('textarea:not(.oe_compact)').val() || '') : ''),
|
||||
|
@ -532,7 +530,6 @@ openerp.mail = function (session) {
|
|||
var context = {
|
||||
'default_model': this.context.default_model,
|
||||
'default_res_id': this.context.default_res_id,
|
||||
'default_content_subtype': 'html',
|
||||
'default_composition_mode': default_composition_mode,
|
||||
'default_parent_id': this.id,
|
||||
'default_body': mail.ChatterUtils.get_text2html(this.$el ? (this.$el.find('textarea:not(.oe_compact)').val() || '') : ''),
|
||||
|
@ -1699,7 +1696,6 @@ openerp.mail = function (session) {
|
|||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
context: {
|
||||
'default_content_subtype': 'html',
|
||||
},
|
||||
};
|
||||
session.client.action_manager.do_action(action);
|
||||
|
@ -1733,7 +1729,7 @@ openerp.mail = function (session) {
|
|||
view_type: 'form',
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
context: { 'default_content_subtype': 'html' },
|
||||
context: {},
|
||||
};
|
||||
session.client.action_manager.do_action(action);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue