Monday, 24 December 2012

Use of lambda in OpenERP 7.0

                                                                                                                    Pinakin Nayi
                                                                                                                    OpenERP , Gandhinagar, India
Different use of lambda in OpenERP 7.0
In OpenERP we are using a lambda function, here i described some of function that all are normally use, that may be useful to you also.
- Map your ids using lambda :
    ids = map(lambda x: x[0],

- Get date using lambda
    'date2': lambda *a: time.strftime('%Y-%m-%d')
- Get Company id using lambda
    'company_id': lambda self,cr,uid,c:    
    self.pool.get('res.users').browse(cr, uid, uid, c),
- Get user id using lambda
    'user_id': lambda self, cr, uid, context=None: uid,
- Get start and end date using lambda
    'date_start': lambda *a: time.strftime('%Y-01-01'),
    'date_stop': lambda *a: time.strftime('%Y-12-31'),
- Get Currency id using lambda
    'currency_id': lambda self,cr,uid,c:self.pool.get('res.users').browse(cr, uid, uid,
- Get month and year using lambda
    'month': lambda *a: time.gmtime()[1],
    'year': lambda *a: time.gmtime()[0],
    'month': lambda *a:,
    'year': lambda *a:,


No comments:

Post a Comment