我在openerp中有一个管理员端数据库和客户端数据库。我需要在客户端db中显示来自admin端db的某些字段。我尝试使用read(),但它不会很好。这是我使用的代码:
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
#Populate local fields with values from external database
nam=cr.dbname
#res = super(sas_clients, self).read(cr, uid, ids, fields=fields, context=context, load=load)
crz = pooler.get_db('con').cursor()
pool_obj=pooler.get_pool('con').get('sas.accounts')
srch_db=pool_obj.search(crz,uid,[('db_name','=',nam)],context=context)
brw_rec=pool_obj.browse(crz,uid,srch_db)
res = super(pool_obj, self).read(cr, uid, srch_db[0], fields=fields, context=context, load=load)
raw_input(res)
#res = [{'name':brw_rec.name},{'expiry_date':brw_rec.expiry_date},{'curr_no_users':brw_rec.curr_no_users},{'package_id':brw_rec.package_id},{'allowed_users':brw_rec.allowed_users}]
return res