[IMP]optimized code for name_get method
bzr revid: jpr@tinyerp.com-20140403111445-lej57pocr2d0qokm
This commit is contained in:
parent
8337d2be8c
commit
911552c2e7
|
@ -1051,7 +1051,9 @@ Launch Manually Once: after having been launched manually, it sets automatically
|
|||
_order="sequence,id"
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
return [(action["id"], "%s" % (action['action_id'][1])) for action in self.read(cr, uid, ids, ['action_id'], context=context)]
|
||||
if not ids:
|
||||
return []
|
||||
return [(rec.id, rec.action_id.name) for rec in self.browse(cr, uid, ids, context=context)]
|
||||
|
||||
def action_launch(self, cr, uid, ids, context=None):
|
||||
""" Launch Action of Wizard"""
|
||||
|
|
|
@ -53,7 +53,7 @@ class ir_config_parameter(osv.osv):
|
|||
]
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
return [(sys_para["id"], "%s" % (sys_para['key'])) for sys_para in self.read(cr, uid, ids, ['key'], context=context)]
|
||||
return [(sys_para.id, "%s" % (sys_para.key)) for sys_para in self.browse(cr, uid, ids, context=context)]
|
||||
|
||||
def init(self, cr, force=False):
|
||||
"""
|
||||
|
|
|
@ -64,6 +64,11 @@ class view_custom(osv.osv):
|
|||
'arch': fields.text('View Architecture', required=True),
|
||||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not ids:
|
||||
return []
|
||||
return [(rec.id, rec.user_id.name) for rec in self.browse(cr, uid, ids, context=context)]
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
super(view_custom, self)._auto_init(cr, context)
|
||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_custom_user_id_ref_id\'')
|
||||
|
|
|
@ -114,7 +114,9 @@ class ir_property(osv.osv):
|
|||
return values
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
return [(ir_property["id"], "%s" % (ir_property['name'] or ir_property['fields_id'][1])) for ir_property in self.read(cr, uid, ids, ['fields_id','name'], context=context)]
|
||||
if not ids:
|
||||
return []
|
||||
return [(rec.id, rec.name or rec.fields_id.field_description) for rec in self.browse(cr, uid, ids, context=context)]
|
||||
|
||||
def write(self, cr, uid, ids, values, context=None):
|
||||
return super(ir_property, self).write(cr, uid, ids, self._update_values(cr, uid, ids, values), context=context)
|
||||
|
|
|
@ -127,8 +127,7 @@ class wkf_transition(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not ids:
|
||||
return []
|
||||
line = self.browse(cr, uid, ids, context=context)
|
||||
return [(line.id, (line.act_from.name) + '+' + (line.act_to.name)) if line.signal == False else (line.id, line.signal) for line in line]
|
||||
return [(line.id, (line.act_from.name) + '+' + (line.act_to.name)) if line.signal == False else (line.id, line.signal) for line in self.browse(cr, uid, ids, context=context)]
|
||||
|
||||
wkf_transition()
|
||||
|
||||
|
|
Loading…
Reference in New Issue