This question has been flagged

Hi Guys,

I have created a custom model, which I also successfully configured in audit trail for create, write & delete operations.

The problem here is when I perform any of such operations through openerp web interface then I can see those operations are being successfully recorded in audit logs. But when I try to do any of such operations through code such as cron/button/xmlrpc webservices or any other areas which will make use of ORM(self.pool.get()) then I see no entries are recorded against auditlogs.

Is there a reason why this is not happening or do I have any unfinished configuration ?

Please let me know if someone faced the same problem or any solutions that someone has got to make it work.


Thanks in Advance.

Avatar
Discard
Best Answer

As you noticed the audittrail module is not working properly in openerp v7, also we have found some others errors and there is an special message for your case in the source code at the file /openerp/osv/osv.py specifically in the function tr that reads:

# We try to do the same as the _(), but without the frame

# inspection, since we aready are wrapping an osv function

# trans_obj = self.get('ir.translation') cannot work yet :(

For your case you need to use something like aspects or weaver like is know in python. I used this library with good results for tasks similar of what you need and also the log auditing is one of the task for what it's designed. The library in question is aspectlib and you could install it from pypi. Here is the docs page http://python-aspectlib.readthedocs.org/
I used and I highly recommend it.


Avatar
Discard