diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 753a92c62b0..6f8ad2e92a3 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -892,9 +892,10 @@ class crm_lead(base_stage, format_address, osv.osv): return {} def _get_subscription_data(self, cr, uid, ids, name, args, context=None): + # 'Convert to Opprtunity' subtype can only show in lead form view. res = super(crm_lead,self)._get_subscription_data(cr, uid, ids, name, args, context=context) - for subtype in self.browse(cr, uid, ids,context=context): - if subtype.type == 'opportunity': - del res[subtype.id]['message_subtype_data']['Convert to Opportunity'] + for leads in self.browse(cr, uid, ids,context=context): + if leads.type == 'opportunity': + del res[leads.id]['message_subtype_data']['Convert to Opportunity'] return res # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 3327312ef9d..a4745cc6806 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -127,7 +127,8 @@ class hr_expense_expense(osv.osv): for expense in self.browse(cr, uid, ids): if expense.employee_id and expense.employee_id.parent_id.user_id: self.message_subscribe_users(cr, uid, [expense.id], user_ids=[expense.employee_id.parent_id.user_id.id]) - self.expense_toapprove_notificate(cr, uid, ids) + self.message_post(cr, uid, ids, body=_("The request is waiting for Approval"), + subtype="hr_expense.mt_expense_approve", context=context) self.write(cr, uid, ids, { 'state':'confirm', 'date_confirm': time.strftime('%Y-%m-%d') @@ -135,7 +136,8 @@ class hr_expense_expense(osv.osv): return True def expense_accept(self, cr, uid, ids, *args): - self.expense_approve_notificate(cr, uid, ids) + self.message_post(cr, uid, ids, body=_("The request has been approved"), + subtype="hr_expense.mt_expense_approved", context=context) self.write(cr, uid, ids, { 'state':'accepted', 'date_valid':time.strftime('%Y-%m-%d'), @@ -144,7 +146,8 @@ class hr_expense_expense(osv.osv): return True def expense_canceled(self, cr, uid, ids, *args): - self.expense_refuse_notificate(cr, uid, ids) + self.message_post(cr, uid, ids, body=_("Request refused"), + subtype="hr_expense.mt_expense_refused", context=context) self.write(cr, uid, ids, {'state':'cancelled'}) return True @@ -237,21 +240,6 @@ class hr_expense_expense(osv.osv): } return result - def expense_toapprove_notificate(self, cr, uid, ids, context=None): - for obj in self.browse(cr, uid, ids): - self.message_post(cr, uid, [obj.id], - _("The request is waiting for Approval"), subtype="hr_expense.mt_expense_approve", context=context) - - def expense_approve_notificate(self, cr, uid, ids, context=None): - for obj in self.browse(cr, uid, ids): - self.message_post(cr, uid, [obj.id], - _("The request has been approved"), subtype="hr_expense.mt_expense_approved", context=context) - - def expense_refuse_notificate(self, cr, uid, ids, context=None): - for obj in self.browse(cr, uid, ids): - self.message_post(cr, uid, [obj.id], - _("Request refused"), subtype="hr_expense.mt_expense_refused", context=context) - hr_expense_expense() class product_product(osv.osv): diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 4a3bc04a6ce..0cb4619d3fe 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -240,7 +240,10 @@ openerp_mail_followers = function(session, mail) { }); var context = new session.web.CompoundContext(this.build_context(), {}); return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], this.message_is_follower ? checklist : undefined, context]) - .then(this.proxy('read_value')); + .then(this.proxy('read_value')).then(function(){ + if(checklist.length == 0){ + return self.do_unfollow();} + }); }, }); };