I have an override of the class ../openerp/addons/base/ir/ir_attachment.py.
I need the id value of the instance in my method overrided _get_path().
My override file contents :
from openerp.osv import osv
import logging
_logger = logging.getLogger(__name__)
class PT_ir_attachment(osv.osv):
_inherit = 'ir.attachment'
_name = 'ir.attachment'
def _get_path(self, cr, uid, bin_data):
fmonth = "avril-2015"
fname = 'osot.png'
fpath = 'dsd'
test = self._full_path(cr, uid, fname)
context = {}
ids = ???? (how could I get instance ID here)
for attach in self.browse(cr, uid, ids, context=context):
if attach.store_fname:
result[attach.id] = self._file_read(cr, uid, attach.store_fname, bin_size)
else:
result[attach.id] = attach.db_datas
_logger.error(self)
_logger.error(fmonth)
_logger.error(fname)
_logger.error(fpath)
_logger.error(test)
_logger.error(context)
_logger.error(uid)
_logger.error(ids)
return fname, fpath
Somebody could help please?