[SOLVED] 登录用户id
-
情况是这样的:
我想在timesheet 的workflow 加一个Transitions 的条件,让创建这张表的人不能够自己去confirm 自己的表。
如draft 到confirm的Condition 就可以设置为 user_id.name!=LOGIN.name。现在的问题就是获取不到当前登录用户的name, 也就是LOGIN.name。
有办法么? -
多谢回复.
其实是想在hr.expense模块使用的, openERP V5.0.10 .
查看坛子里另一条http://shine-it.net/index.php/topic,2082.0.html
通过attrs来控制按钮可见,只读。。
<button attrs="{'invisible':[('user_id', 'not in', [uid])]}" name="validate" states="confirm" string="Accept" type="workflow"/>
却没有效果。 -
修改 hr_expense.py
<br />def expense_accept(self, cr, uid, ids, *args):<br /> # 任何人都不能 accept 自己创建的 expense<br /> userID = self.browse(cr, uid, ids)[0].user_id.id<br /> if userID == uid:<br /> raise osv.except_osv(_('Error !'), _('You can not accept your expense by yourself!'))<br />