[FIX] crm: fix some missing bits after the big refactoring
bzr revid: odo@openerp.com-20120823193130-4u42mhyih43k32nb
This commit is contained in:
parent
2c4ed841b9
commit
a7193cb193
|
@ -635,7 +635,7 @@ class crm_lead(base_stage, osv.osv):
|
|||
partner_id = False
|
||||
if lead.partner_name and lead.contact_name:
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.partner_name, True, context=context)
|
||||
self._lead_create_contact(cr, uid, lead, lead.contact_name, False, partner_id, context=context)
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.contact_name, False, partner_id, context=context)
|
||||
elif lead.partner_name and not lead.contact_name:
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.partner_name, True, context=context)
|
||||
elif not lead.partner_name and lead.contact_name:
|
||||
|
|
|
@ -50,16 +50,19 @@ class crm_lead2partner(osv.osv_memory):
|
|||
def _select_partner(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
lead = self.pool.get('crm.lead')
|
||||
partner = self.pool.get('res.partner')
|
||||
lead_ids = list(context and context.get('active_ids', []) or [])
|
||||
if not len(lead_ids):
|
||||
if not context.get('active_model') == 'crm.lead' or not context.get('active_id'):
|
||||
return False
|
||||
this = lead.browse(cr, uid, lead_ids[0], context=context)
|
||||
if not partner_id and this.partner_name:
|
||||
partner = self.pool.get('res.partner')
|
||||
lead = self.pool.get('crm.lead')
|
||||
this = lead.browse(cr, uid, context.get('active_id'), context=context)
|
||||
if this.email_from:
|
||||
partner_ids = partner.search(cr, uid, [('email', '=', this.email_from)], context=context)
|
||||
if partner_ids:
|
||||
partner_id = partner_ids[0]
|
||||
if not this.partner_id and this.partner_name:
|
||||
partner_ids = partner.search(cr, uid, [('name', '=', this.partner_name)], context=context)
|
||||
if partner_ids and len(partner_ids):
|
||||
partner_id = partner_ids[0]
|
||||
if partner_ids:
|
||||
partner_id = partner_ids[0]
|
||||
return partner_id
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
|
|
|
@ -97,7 +97,7 @@ class crm_helpdesk_report(osv.osv):
|
|||
c.planned_cost,
|
||||
count(*) as nbr,
|
||||
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
|
||||
(SELECT count(id) FROM mail_message WHERE model='crm.helpdesk' AND res_id=c.id AND email_from IS NOT NULL) AS email,
|
||||
(SELECT count(id) FROM mail_message WHERE model='crm.helpdesk' AND res_id=c.id AND type = 'email') AS email,
|
||||
abs(avg(extract('epoch' from (c.date_deadline - c.date_closed)))/(3600*24)) as delay_expected
|
||||
from
|
||||
crm_helpdesk c
|
||||
|
|
Loading…
Reference in New Issue