Hello there,
In Odoo 8, if I'm trying to delete the attachment "/sitemap.xml" each day to refresh it.
I'm trying this way but I get an error :
Error is :
2016-12-08 09:07:37,267 14478 ERROR odoo-iv openerp.addons.base.ir.ir_cron: Call of self.pool.get('ir.attachment')._file_delete(cr, uid, *('/', 's', 'i', 't', 'e', 'm', 'a', 'p', '.', 'x', 'm', 'l')) failed in Job 10
Traceback (most recent call last):
File "/home/odoo-iv/odoo-8.0-20161109/openerp/addons/base/ir/ir_cron.py", line 138, in _callback getattr(model, method_name)(cr, uid, *args)
File "/home/odoo-iv/odoo-8.0-20161109/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
TypeError: _file_delete() takes exactly 4 arguments (15 given)
Somebody could help?
EDIT #1
Answer From Axel was right.
But I think to delete a file, I have to use the unlink function of ir.attachement class. This function needs IDs to delete attachments. See image below, I have deleted two attachments with this action :
But now, big problem... When the new sitemap.xml attachment is recreated, it doesn't have the same id... So the action is unusable. How to overcome this problem?