Odoo Help

1

Audit Trial is not recording entries done through ORM (Python Code)

By
Komala Kiran Kumar. Parepalli
on 2/9/16, 11:44 PM 1,011 views

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.

1
Axel Mendoza
On 2/10/16, 1:10 AM

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.


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/9/16, 11:44 PM
Seen: 1011 times
Last updated: 1/10/17, 1:48 AM