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'"
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.