From cbe2dbb672a6c55d86f2e515f9d1cdfee426ef80 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Sun, 6 Jul 2014 16:44:26 +0200 Subject: [MERGE] new v8 api by rco A squashed merge is required as the conversion of the apiculture branch from bzr to git was not correctly done. The git history contains irrelevant blobs and commits. This branch brings a lot of changes and fixes, too many to list exhaustively. - New orm api, objects are now used instead of ids - Environements to encapsulates cr uid context while maintaining backward compatibility - Field compute attribute is a new object oriented way to define function fields - Shared browse record cache - New onchange protocol - Optional copy flag on fields - Documentation update - Dead code cleanup - Lots of fixes --- addons/document/document.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/document/document.py') 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 -- cgit v1.2.3