summaryrefslogtreecommitdiff
path: root/addons/document/document.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/document/document.py')
-rw-r--r--addons/document/document.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index d611539a00a..96868d3d66b 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -562,6 +562,7 @@ class document_storage(osv.osv):
# to write the fname and size, and update them in the db concurrently.
# We cannot use a write() here, because we are already in one.
cr.execute('UPDATE ir_attachment SET file_size = %s, index_content = %s, file_type = %s WHERE id = %s', (filesize, icont_u, mime, file_node.file_id))
+ self.pool.get('ir.attachment').invalidate_cache(cr, uid, ['file_size', 'index_content', 'file_type'], [file_node.file_id], context=context)
file_node.content_length = filesize
file_node.content_type = mime
return True
@@ -1114,7 +1115,7 @@ class node_dir(node_database):
if not self.check_perms('u'):
raise IOError(errno.EPERM,"Permission denied.")
- if directory._table_name=='document.directory':
+ if directory._name == 'document.directory':
if self.children(cr):
raise OSError(39, 'Directory not empty.')
res = self.context._dirobj.unlink(cr, uid, [directory.id])
@@ -1694,7 +1695,7 @@ class node_file(node_class):
return False
document = document_obj.browse(cr, uid, self.file_id, context=self.context.context)
res = False
- if document and document._table_name == 'ir.attachment':
+ if document and document._name == 'ir.attachment':
res = document_obj.unlink(cr, uid, [document.id])
return res