Keep track of workflow change in OpenERP 7.0 -
is there way keep track of changes made on workflow status users can follow through process i'm implementing.
ex: created on march 1st, user 1. submitted on march 1st, user 1. reviewing on march 2nd, admin. evaluating on march 4th, superuser. accepted on march 6th, megauser.
so, fists record inserted when request created, second when workflow button "submit" clicked; third when workflow button "review" clicked , on.
any thoughts or sugestions more welcome!
using records of audit trail not option this.
thanks in advance. -fc.
i've solved using self.pool.get('obj_name').create(cr, uid,values) create new entries in second table.
used function:
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
and called it, each time workflow changed, e.g:
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
i'll leave here, same problem having. tips!
have table inherit mail.thread
, , have buttons send messages followers.
here's stripped down version of 1 of tables have implemented:
class fnx_sr_shipping(osv.model): _name = 'fnx.sr.shipping' _description = 'shipping & receiving' _inherit = ['mail.thread'] _mail_flat_thread = false ... def create(self, cr, uid, values, context=none): ... body = "some message" follower_ids = [47, 29, 31] # actual ids here ... new_id = super(fnx_sr_shipping, self).create(cr, uid, values, context=context) self.message_post(cr, uid, new_id, body=body, partner_ids=follower_ids, subtype='mt_comment', context=context) return new_id def sr_complete(self, cr, uid, ids, context=none): ... id in ids: current = self.browse(cr, uid, id, context=context) if self.write(cr, uid, id, values, context=context): context['mail_create_nosubscribe'] = true followers = self._get_followers(cr, uid, [id], none, none, context=context)[id]['message_follower_ids'] message = 'complete: ...' self.message_post(cr, uid, id, body=message, subtype='mt_comment', partner_ids=followers, context=context) return true
and in xml
file:
<button string="complete" name="sr_complete" type="object"/>
Comments
Post a Comment