Showing created by user name on OpenERP records

醉酒当歌 提交于 2019-12-11 05:56:09

问题


On any record/object in OpenERP, such as Journal Voucher, Journal Entry, etc. is there a way to show which user created or posted this record?

I would like to show this on the record itself when we open the detail view. Ideally this should also be visible in the search grids.

The audit trail feature lets you view it in a separate area and it captures a lot more detail, but I would like to capture and show only the user name who worked on a record.

Thanks


回答1:


You can use write_uid, create_uid and for that you have to override those fields in your model.
You can even make related field for name.

_columns = {
    'create_uid': fields.many2one('res.users', 'Created By', readonly=True),
    'creator_name': fields.related("create_uid", "name", type="char", string="Creator Name"),
    'write_uid': fields.many2one('res.users', 'Modified By'),
    'write_name': fields.related("write_uid", "name", type="char", string="Moderator Name"),
}

Here, create_uid must be "readonly=True" otherwise you will face an error while saving a record.



来源:https://stackoverflow.com/questions/13602535/showing-created-by-user-name-on-openerp-records

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!