[IMP]improve as per comment
bzr revid: sgo@tinyerp.com-20121127130723-44i0t3v89ewdy8zw
This commit is contained in:
parent
ef9c35a5cd
commit
927491120a
|
@ -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:
|
||||
|
|
|
@ -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 <b>waiting for Approval</b>"),
|
||||
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 <b>approved</b>"),
|
||||
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 <b>refused</b>"),
|
||||
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 <b>waiting for Approval</b>"), 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 <b>approved</b>"), 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 <b>refused</b>"), subtype="hr_expense.mt_expense_refused", context=context)
|
||||
|
||||
hr_expense_expense()
|
||||
|
||||
class product_product(osv.osv):
|
||||
|
|
|
@ -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();}
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue