[IMP] partner_geo_assign: correct forward wizard call + improve view labels
bzr revid: odo@openerp.com-20100629105404-nk9jw7sxyw7w4ykv
This commit is contained in:
@@ -26,7 +26,6 @@ import random, time
|
||||
from tools.translate import _
|
||||
|
||||
def geo_find(addr):
|
||||
import urllib,re
|
||||
regex = '<coordinates>([+-]?[0-9\.]+),([+-]?[0-9\.]+),([+-]?[0-9\.]+)</coordinates>'
|
||||
url = 'http://maps.google.com/maps/geo?q=' + urllib.quote(addr) + '&output=xml&oe=utf8&sensor=false'
|
||||
xml = urllib.urlopen(url).read()
|
||||
@@ -50,7 +49,6 @@ class res_partner(osv.osv):
|
||||
'partner_weight': lambda *args: 0
|
||||
}
|
||||
def geo_localize(self, cr, uid, ids, context=None):
|
||||
regex = '<coordinates>([+-]?[0-9\.]+),([+-]?[0-9\.]+),([+-]?[0-9\.]+)</coordinates>'
|
||||
for partner in self.browse(cr, uid, ids, context=context):
|
||||
if not partner.address:
|
||||
continue
|
||||
@@ -84,12 +82,13 @@ class crm_lead(osv.osv):
|
||||
email = lead.partner_assigned_id.address[0].email
|
||||
if not email:
|
||||
raise osv.except_osv(_('Error !'), _('No email on the partner assigned to this opportunity'))
|
||||
forward = fobj.create(cr, uid, {
|
||||
'name': 'email',
|
||||
values = fobj.default_get(cr, uid, ['email_from'], context=context)
|
||||
values.update({
|
||||
'history': 'whole',
|
||||
'email_to': email,
|
||||
'message': fobj._get_case_history(cr, uid, 'whole', lead.id, context) or False
|
||||
}, context)
|
||||
'message': fobj._get_case_history(cr, uid, 'whole', lead.id, context) or False,
|
||||
})
|
||||
forward = fobj.create(cr, uid, values, context)
|
||||
fobj.action_forward(cr, uid, [forward], context)
|
||||
else:
|
||||
raise osv.except_osv(_('Error !'), _('No partner assigned to this opportunity'))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_crm_opportunity_geo_assign_form" model="ir.ui.view">
|
||||
<field name="name">crm.lead.geo_assign.inherit</field>
|
||||
<field name="model">crm.lead</field>
|
||||
@@ -9,7 +8,7 @@
|
||||
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook[last()]" position="inside">
|
||||
<page string="Partner Assignation">
|
||||
<page string="Geo Assignation">
|
||||
<field name="partner_assigned_id"/>
|
||||
<newline/>
|
||||
<field name="partner_latitude"/>
|
||||
@@ -36,7 +35,7 @@
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook[last()]" position="inside">
|
||||
<page string="Partner Association">
|
||||
<page string="Geo Location">
|
||||
<field name="partner_weight"/>
|
||||
<label string="" colspan="1"/>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user