From 7c3569385fa5cd5e32899a3b044a71605aeb07d5 Mon Sep 17 00:00:00 2001 From: "Amit Patel (OpenERP)" Date: Wed, 29 Aug 2012 12:12:43 +0530 Subject: [PATCH] [IMP]:default work with demo data and remove readonly from subtype bzr revid: apa@tinyerp.com-20120829064243-w0y3k6c3uxcqruzm --- addons/crm/crm_lead.py | 4 +++- addons/mail/mail_thread.py | 2 +- addons/mail/static/src/js/mail_followers.js | 1 - addons/mail/static/src/xml/mail_followers.xml | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index c4423520847..75c1863c4d8 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -278,9 +278,11 @@ class crm_lead(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): obj_id = super(crm_lead, self).create(cr, uid, vals, context) + subtype_obj = self.pool.get('mail.message.subtype'); + subtype_ids = subtype_obj.search(cr, uid, [('default', '=', 'true'),('model_ids.model', '=', 'crm.lead')]) record = self.browse(cr, uid, obj_id, context) if record.user_id: - self.message_subscribe(cr, uid, [obj_id], [record.user_id.id], context = context) + self.message_subscribe(cr, uid, [obj_id], [record.user_id.id], subtype_ids,context = context) self.create_send_note(cr, uid, [obj_id], context=context) return obj_id diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 04a71a91a5b..0e1e90f39df 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1051,7 +1051,7 @@ class mail_thread(osv.Model): write_res = self.write(cr, uid, ids, {'message_follower_ids': self.message_subscribe_get_command(cr, uid, to_subscribe_uids, context)}, context=context) follower_ids = [follower.id for thread in self.browse(cr, uid, ids, context=context) for follower in thread.message_follower_ids] if subtype_ids: - self.pool.get('mail.followers').write(cr, uid, follower_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) + self.message_subscribe_udpate_subtypes(cr, uid, ids, user_ids, subtype_ids, context=context) return follower_ids def message_subscribe_get_command(self, cr, uid, follower_ids, context=None): diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 4a328fbbc55..7e150051f7f 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -101,7 +101,6 @@ openerp_mail_followers = function(session, mail) { display_subscribers: function (records) { var self = this; this.is_subscriber = false; - if (self.view.get("actual_mode") === "edit"){self.update_subtype();} var user_list = this.$el.find('ul.oe_mail_followers_display').empty(); this.$el.find('div.oe_mail_recthread_followers h4').html(this.params.title + ' (' + records.length + ')'); _(records).each(function (record) { diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index b0e19e57579..3bdd18bb0a0 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -40,8 +40,7 @@ - - +