It is currently Mon May 21, 2012 7:33 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Object orientation 101 - lesson needed
PostPosted: Tue Aug 02, 2011 4:15 pm 
Offline

Joined: Tue Mar 09, 2010 4:08 pm
Posts: 117
Hi

Please excuse me for asking such a basic question. I feel I should know this but can't figure it out.

The following "onchange" function receives the "partner_id" and uses it to extract the partner address details on the "Sales Order" screen.
Code:
onchange_partner_id(self, cr, uid, ids, part)
....
    addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
    address_obj = self.pool.get('res.partner.address')
    street = address_obj.get_street(cr, uid, addr['default'])


There are many examples of this where the fields are "many2one".

I however just want to access a simple boolean variable that is part of the res.partner object.

Code:
class res_partner(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'
    _columns = {
        'abc': fields.boolean('ABC'),
    }
res_partner()


What is the simplest way to do that in the context of the onchange_partner_id function?

Any pointer would be greatly appreciated

Thanks
O.


Top
 Profile  
 
 Post subject: Re: Object orientation 101 - lesson needed
PostPosted: Tue Aug 02, 2011 9:33 pm 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
Code:
onchange_partner_id(self, cr, uid, ids, part)
....
    partner = self.pool.get('res.partner').browse(cr, uid, part, context)
    boolean = partner.abc

_________________
Graeme


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