It is currently Tue May 22, 2012 11:12 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How to use browse method to retrieve records from a object
PostPosted: Fri May 20, 2011 9:44 am 
Offline

Joined: Fri May 28, 2010 10:33 am
Posts: 409
Hi, I need help to access (example) a object from partners:
Code:
def muestra_productos_logs(self, cr, uid, ids, context=None):
      cur_obj={}
      cur_obj = self.pool.get('res.partner').browse(cr, uid, ids,
context=context)
...


And the call to function from xml view:
Code:
<field name="contratados_ids" colspan="4" nolabel="1" on_change="muestra_productos_logs()">


With only this code, the error is:
Code:
TypeError: muestra_productos_logs() takes at least 6 arguments (5 given)



I think this is a basic error, but I dont find info (clear and commented) about orm methods.

Some doc about this methods?

Thankyou
Juanjo A

_________________
Formación online OpenERP - Programación módulos - Apoyo instalación
http://www.malagatic.com @malagatic


Top
 Profile  
 
 Post subject: Re: How to use browse method to retrieve records from a obje
PostPosted: Fri May 20, 2011 1:56 pm 
Offline

Joined: Sat Feb 05, 2011 9:05 pm
Posts: 28
Specify fields which values you want to check:
Code:
<field name="contratados_ids" colspan="4" nolabel="1" on_change="muestra_productos_logs(name,state)">


Then you'll have access to these values in your method
Code:
def muestra_productos_logs(self, cr, uid, ids, name=None, state=None, context=None):
      cur_obj={}
      cur_obj = self.pool.get('res.partner').browse(cr, uid, ids,
context=context)
      if state=='draft':
    ........


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