Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4910 Lượt xem

I'm trying to overwrite delete method with log information into the db:

def post_write(self, cr, uid, ids, action, model, context=None):
    if isinstance(ids, (int, long)):
      ids = [ids]
    queue = self.pool.get("hr.changes.queue")
    for id in ids:
        queue.create(self, cr, uid, {
            "action": action,
            "related_model": model,
            "affected_id": id
        })

def unlink(self, cr, uid, ids, context=None):
    self.post_write(self, cr, uid, ids, "delete", "hr.employee")
    return super(hr_employee, self).unlink(cr, uid, ids)

but I have this error: "'hr.employee' object has no attribute 'execute'"

Ảnh đại diện
Huỷ bỏ

At least you don't pass context in your method unlink. Probably won't fix it, but it is better to do it. In your code, there is no execute, Can you post the complete stacktrace, it will probably tell you something more.

Câu trả lời hay nhất

Hi,

Another way to follow users operations see module Audit Trail audittrail exists in the apps openerp.

This module lets administrator track every user operation on all the objects of the system.

The administrator can subscribe to rules for read, write and delete on objects and can check logs.

installl this module and in menu Reporting>>Audit Rules define the objects to be tracked . For example partner:

image description

Ảnh đại diện
Huỷ bỏ
Tác giả

No, its not all the task and installing this module is not solution.

Yes, you can track one operation 'delete' for one object 'hr.employee' and not all task for all objects.

Tác giả

I think installing the whole module is not the best solution if I can do it by overwriting the only method.

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 15
5202
3
thg 11 24
30355
1
thg 12 21
2943
0
thg 12 21
2460
3
thg 12 15
1367