You are on page 1of 3

(Feb 18 '13)

(Feb 18 '13)


def par se_descr i pt i on( descr i pt i on) :
' ' '
t her e i s par se f unct i on
I t i s exampl e f or par si ng messages l i ke t hi s:
Name: J ohn
Phone: +100500
' ' '
f i el ds=[ ' name' , ' phone' ]
_di ct ={}
descr i pt i on=descr i pt i on. l ower ( )
for l i ne in descr i pt i on. spl i t ( ' \ n' ) :
for f i el d in f i el ds:
if f i el d in l i ne:
spl i t _l i ne=l i ne. spl i t ( ' : ' )
if l en( spl i t _l i ne) >1:
pr e_di ct [ f i el d] =l i ne. spl i t ( ' : ' ) [ 1]
return di ct



Sort by
customize the auto lead creation through incoming emails - OpenERP Helphttp://help.openerp.com/question/272/customize-the-auto-lead-creation...
1 sur 3 10/03/2014 01:08
l ead=self. br owse( cr , ui d, cont ext [ ' act i ve_i d' ] , cont ext =cont ext )
descr i pt i on=l ead[ ' descr i pt i on' ]
_di ct =par se_descr i pt i on( descr i pt i on)
self. wr i t e( cr , ui d, cont ext [ ' act i ve_i d' ] , {
' par t ner _name' : _di ct . get( ' name' ) ,
' cont act _name' : _di ct . get( ' name' ) ,
' phone' : _di ct . get( u' phone' ) ,
' mobi l e' : _di ct . get( u' phone' ) })
(Jul 19 '13)
(Jul 19 '13)
(Oct 22 '13)

message_new
mai l _t hr ead
def message_new( self, cr , ui d, msg_di ct , cust om_val ues=None, cont ext =None) :
. . .
if cust om_val ues and i sI nst ance( cust om_val ues, di ct ) :
dat a. updat e( cust om_val ues)
r es_i d = model . pool . cr eat e( cr , ui d, dat a, cont ext =cont ext )
return r es_i d
cust om_val ues. updat e( {' name' :
' what ever you want ' })
cust om_val ues
message_new
mai l _t hr ead
message_updat e
updat e_val s
def message_updat e( self, cr , ui d, i ds, msg_di ct , updat e_val s=None, cont ext =None) :
if updat e_val s:
self. wr i t e( cr , ui d, i ds, updat e_val s, cont ext =cont ext )
customize the auto lead creation through incoming emails - OpenERP Helphttp://help.openerp.com/question/272/customize-the-auto-lead-creation...
2 sur 3 10/03/2014 01:08
customize the auto lead creation through incoming emails - OpenERP Helphttp://help.openerp.com/question/272/customize-the-auto-lead-creation...
3 sur 3 10/03/2014 01:08