It is currently Wed May 23, 2012 3:18 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Preenchimento automatico
PostPosted: Wed Sep 21, 2011 10:47 am 
Offline

Joined: Wed Aug 17, 2011 5:52 pm
Posts: 56
Location: Maputo
Bom dia a todos,
tenho uma dúvida; Possuo dois campos partner_id (many2one de res.partner) e partner_address (many2one de res.partner.address), eu gostaria de saber como posso fazer para ao selecionar o cliente com partner_id o OpenERP preencha automaticamente o endereço (partner_address)

_________________
Dércio Duvane
DotCom, LDA
Maputo, Mozambique


Top
 Profile  
 
 Post subject: Re: Preenchimento automatico(RESOLVIDO)
PostPosted: Thu Sep 29, 2011 9:50 am 
Offline

Joined: Wed Aug 17, 2011 5:52 pm
Posts: 56
Location: Maputo
Após alguma leitura,
Eis a solução:

Code:
def on_change_partner(self,cr,uid,ids,partner_id):
        val = {}
        if partner_id:
            addr = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['default'])
            val = {'address_id': addr['default'],}
            return {'value': val}

_________________
Dércio Duvane
DotCom, LDA
Maputo, Mozambique


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP