Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4739 Widoki

Hi,

Is there a way to keep track of changes made on workflow status so that users can follow through the process I'm implementing.

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.

So, the fists record would be inserted when the request is created, the second when the workflow button "submit" is clicked; the third when the workflow button "review" is clicked and so on.

Any thoughts or sugestions are more than welcome!

Using the records of Audit Trail is not an option for this.

Thanks in advance. -FC.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

I've solved this using self.pool.get('obj_name').create(cr, uid,values) to create new entries in that second table.

used this 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 this here, to help anyone with the same problem that I was having.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
mar 15
3767
0
mar 23
1621
2
sty 22
5153
1
sie 25
442
2
lip 25
619