I'm developing an OpenERP 7 module and I need to add a field that logs the user who created each record. How do I retrieve the current user object?
0
votes
2 Answers
1
votes
In OpenERP Python code, functions generally take cr
, the database pointer, and uid
, the user id, as arguments. If all you need is the id of the current res.users
object (for instance, to write into the one2many field), you can use uid
as is. If you need to access the object (to see fields, etc.), something like:
current_user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
should work.