customize the auto lead creation through incoming emails - openerp help

Upload: achrefo-mh

Post on 09-Oct-2015

8 views

Category:

Documents


0 download

TRANSCRIPT

  • 5/20/2018 Customize the Auto Lead Creation Through Incoming Emails - OpenERP Help

    1/3

    (Feb 18 '13)

    (Feb 18 '13)

    def par se_descri pt i on( descr i pt i on) :

    ' ' '

    t her e i s par se f uncti on

    I t i s exampl e f or parsi 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=descri pt i on. l ower ( )

    for l i ne in descr i pt i on. s pl i t ( ' \ n' ) :

    for f i el d in f i el ds:

    if f i el d in l i ne: s pl i t _ l i ne=l i ne. spl i t ( ' : ' )

    if l en( spl i t _ l i ne) >1:

    pre_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

  • 5/20/2018 Customize the Auto Lead Creation Through Incoming Emails - OpenERP Help

    2/3

    l ead=self. browse( cr , ui d, cont ext[ ' act i ve_ i d' ] , context =context )

    descr i pt i on=l ead[ ' descr i pt i on' ]

    _di ct =parse_descri pt i on( descr i pt i on)

    self. wr i te( 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, context =None) :

    . . . if cust om_val ues and i s I nstance( cust om_val ues, di ct ) :

    dat a. update( cust om_val ues)

    res_i d = model . pool . creat e( cr , ui d, dat a, context =cont ext)

    return res_ i d

    cust om_val ues. updat e({' name' :

    ' what ever you want ' })

    cust om_val ues

    mess age_new

    mai l _t hr ead

    mess age_update

    updat e_val s

    def message_ updat e( self, cr , ui d, i ds, msg_di ct , updat e_val s=None, context =None) :

    if updat e_val s:

    self. wr i te( cr , ui d, i ds, updat e_val s, context =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

  • 5/20/2018 Customize the Auto Lead Creation Through Incoming Emails - OpenERP Help

    3/3

    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