在openerp中显示来自不同数据库的值

时间:2014-12-29 09:41:53

标签: python openerp odoo

我在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

0 个答案:

没有答案