有没有办法跟踪对工作流状态所做的更改,以便用户可以遵循我正在实施的流程。
Ex:
Created on March 1st, by User 1.
Submitted on March 1st, by User 1.
Reviewing on March 2nd, by Admin.
Evaluating on March 4th, by SuperUser.
Accepted on March 6th, by MegaUser.
因此,第一个记录将在创建请求时插入,第二个在单击工作流按钮“提交”时插入;第三次单击工作流按钮“审阅”时,依此类推。
任何想法或建议都非常受欢迎!
使用 Audit Trail 的记录不是一个选项。
提前致谢。-FC。
我已经使用 self.pool.get('obj_name').create(cr, uid,values) 在第二个表中创建新条目解决了这个问题。
使用了这个功能:
def insert_trace(self, cr, uid, id_request, context=None):
request = self.browse(cr, uid, id_request, context)
values = {
'generic_request_id': id_request[0],
'executor': self._get_user(cr, uid, context),
'state': request[0].state,
}
tracing_ids = self.pool.get('tracing').create(cr, uid,values)
return True
并在每次工作流程更改时调用它,例如:
def request_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft'})
self.insert_trace(cr, uid, ids, context)
return True
def submit_request(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'submitted'})
self.insert_trace(cr, uid, ids, context)
return True
我将把它留在这里,以帮助任何与我遇到同样问题的人。感谢您的提示!