I'm trying to read a field inside an object from another class from the one having this function in openerp:
def desc_cert(self, cr, uid, ids, field_name, field_args, context=None):
obj = self.pool.get('purchase.order')
pids = obj.search(cr, uid [('sel_cert', '=', 'si')])
val = self._get_product_available_func(('done'))
if pids == 'si':
return val
Being sel_cert
the field in the class i'm trying to read from self.pool.get
, i'm still learning OpenErp but this code gives me the error you see in the title of this post, here's the traceback:
Server Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\web\session.py", line 89, in send
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\netsvc.py", line 292, in dispatch_rpc
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\service\web_services.py", line 626, in dispatch
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 188, in execute_kw
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 131, in wrapper
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 197, in execute
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\osv.py", line 185, in execute_cr
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\orm.py", line 3604, in read
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\orm.py", line 3724, in _read_flat
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\.\openerp\osv\fields.py", line 1133, in get
File "C:\Program Files\OpenERP 7.0-20130726-231403\Server\server\openerp\addons\product\product.py", line 456, in desc_cert
TypeError: 'int' object is unsubscriptable
I can't understand what is wrong with the code, i already saw a very similar example in the account
module, what i'm trying to achieve is to read the field sel_cert
from purchase.order
object, which is a selection
type field, so if this field has si
selected then do _get_product_available_func(('done'))
Just for verbosity sakes :)
So, anybody could shed some light on this?
Thanks in advance!
uid
? – DonCallisto