[IMP]Improve code for crm also

bzr revid: dbr@tinyerp.com-20130910131205-39cwpiik2ncs6wcn
This commit is contained in:
DBR (OpenERP)
2013-09-10 18:42:05 +05:30
parent 5f733248c3
commit efc8bb37a9
4 changed files with 3 additions and 18 deletions
+3 -1
View File
@@ -68,7 +68,9 @@ class crm_meeting(osv.Model):
if context is None:
context = {}
meeting_id = super(crm_meeting, self).create(cr, uid, vals, context=context)
if context.get('log_meeting_in_parent'):
parent_model = context.get('active_model',False)
parent_ids = context.get('active_ids', False)
if parent_model and parent_ids:
self.log_meeting_in_parent(cr, uid, [meeting_id], context=context)
return meeting_id
-8
View File
@@ -1008,14 +1008,6 @@ class crm_lead(format_address, osv.osv):
message = _("%s a call for %s.%s") % (prefix, phonecall.date, suffix)
return self.message_post(cr, uid, ids, body=message, context=context)
def log_meeting(self, cr, uid, ids, meeting_subject, meeting_date, duration, context=None):
if not duration:
duration = _('unknown')
else:
duration = str(duration)
message = _("Meeting scheduled at '%s'<br> Subject: %s <br> Duration: %s hour(s)") % (meeting_date, meeting_subject, duration)
return self.message_post(cr, uid, ids, body=message, context=context)
def onchange_state(self, cr, uid, ids, state_id, context=None):
if state_id:
country_id=self.pool.get('res.country.state').browse(cr, uid, state_id, context).country_id.id
-8
View File
@@ -34,14 +34,6 @@ class crm_meeting(osv.Model):
'opportunity_id': fields.many2one ('crm.lead', 'Opportunity', domain="[('type', '=', 'opportunity')]"),
}
def create(self, cr, uid, vals, context=None):
res = super(crm_meeting, self).create(cr, uid, vals, context=context)
obj = self.browse(cr, uid, res, context=context)
if obj.opportunity_id:
self.pool.get('crm.lead').log_meeting(cr, uid, [obj.opportunity_id.id], obj.name, obj.date, obj.duration, context=context)
return res
class calendar_attendee(osv.osv):
""" Calendar Attendee """
-1
View File
@@ -295,7 +295,6 @@ class hr_applicant(osv.Model):
'default_user_id': uid,
'default_name': applicant.name,
'default_categ_ids': category and [category.id] or False,
'log_meeting_in_parent': True,
}
return res