[FIX] crm: Click on Ge Assing button Traceback generate , put comments created demo data of crm_lead for onchange event
bzr revid: ron@tinyerp.com-20111123054347-0mo8pkly1857beff
This commit is contained in:
parent
c565752d00
commit
e2c80d7ca8
|
@ -123,7 +123,7 @@ Creates a dashboard for CRM that includes:
|
|||
'test/process/merge_opportunity.yml',
|
||||
'test/process/cancel_lead.yml',
|
||||
'test/process/segmentation.yml',
|
||||
'test/ui/demo_data.yml',
|
||||
#'test/ui/demo_data.yml', TODO : After installing crm_partner_assign view error
|
||||
'test/ui/duplicate_lead.yml',
|
||||
'test/ui/delete_lead.yml'
|
||||
],
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<field name="partner_latitude"/>
|
||||
<field name="partner_longitude"/>
|
||||
<group colspan="1" col="1">
|
||||
<button string="Geo Assign" name="assign_partner" type="object" colspan="1"
|
||||
<button string="Geo Assign" name="action_assign_partner" type="object" colspan="1"
|
||||
icon="gtk-apply"/>
|
||||
</group>
|
||||
</group>
|
||||
|
|
|
@ -118,6 +118,9 @@ class crm_lead(osv.osv):
|
|||
'user_id' : user_id}
|
||||
}
|
||||
|
||||
def action_assign_partner(self, cr, uid, ids, context=None):
|
||||
return self.assign_partner(cr, uid, ids, partner_id=False, context=context)
|
||||
|
||||
def assign_partner(self, cr, uid, ids, partner_id=False, context=None):
|
||||
partner_ids = {}
|
||||
res = False
|
||||
|
@ -127,6 +130,9 @@ class crm_lead(osv.osv):
|
|||
for lead in self.browse(cr, uid, ids, context=context):
|
||||
if not partner_id:
|
||||
partner_id = partner_ids.get(lead.id, False)
|
||||
if not partner_id:
|
||||
continue
|
||||
self.assign_geo_localize(cr, uid, [lead.id], lead.partner_latitude, lead.partner_longitude, context=context)
|
||||
partner = res_partner.browse(cr, uid, partner_id, context=context)
|
||||
if partner.user_id:
|
||||
for lead_id in ids:
|
||||
|
@ -188,7 +194,7 @@ class crm_lead(osv.osv):
|
|||
# 5. fifth way: anywhere in same country
|
||||
if not partner_ids:
|
||||
# still haven't found any, let's take all partners in the country!
|
||||
partner_ids = partner.search(cr, uid, [
|
||||
partner_ids = res_partner.search(cr, uid, [
|
||||
('partner_weight', '>', 0),
|
||||
('country', '=', lead.country_id.id),
|
||||
], context=context)
|
||||
|
|
Loading…
Reference in New Issue