openerp - trying to understand better the orm methods but i can store a value in a field -


i want store field's value 'por_sucursal' res_users class in field 'probando' pruebas value boolean , can store need filter in xml file.

class pruebas(osv.model):     _name = 'pruebas'     _description = 'sucursales de la empresa'     def dame_usuario2(self, cr, uid, ids, field_names=none, arg=false, context=none):     if context none:         context = {}     var_pool = self.pool.get('res_users')     if var_pool:         ids = var_pool.search(cr, uid, [('id','=',uid)])         if ids:             return ids[0].por_sucursal   _columns = {                     'name': fields.char('prueba', size=50, help="probando"),         'probando': fields.function(dame_usuario2, type='boolean', store=true,                                             readonly = true),             } pruebas() 

try following,

class pruebas(osv.model):     _name = 'pruebas'     _description = 'sucursales de la empresa'         def dame_usuario2(self, cr, uid, ids, field_names=none, arg=false, context=none):         if context none:             context = {}         var_pool = self.pool.get('res.users')         res = {}         obj in self.browse(cr, uid, ids, context=context):             res[obj.id] = false             user = var_pool.browse(cr, uid, uid, context=context)             if user:                 res[obj.id] = user.por_sucursal         return res      _columns = {                         'name': fields.char('prueba', size=50, help="probando"),             'probando': fields.function(dame_usuario2, type='boolean', store=true, readonly = true),                 } pruebas() 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -