summaryrefslogtreecommitdiff
path: root/addons/document/document.py
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2011-05-02 20:46:43 +0200
committerOlivier Dony <odo@openerp.com>2011-05-02 20:46:43 +0200
commit560915cb680de75f48707d32e589bd80f569bba7 (patch)
tree5d9e35e005549daba3a8ab9912bafc35da016586 /addons/document/document.py
parent1c32950e4310f1be256680b329babd8c83696f11 (diff)
parent2730e322cfad70f1fa274de96bcc96ec28b77983 (diff)
[MERGE] merged latest fixes from 6.0 up to r.4556
Rev 4556 = revision-id: jvo@tinyerp.com-20110502133745-s1zyed65h6ojwkvk. bzr revid: odo@openerp.com-20110502184643-d3qzosqdurscd51i
Diffstat (limited to 'addons/document/document.py')
-rw-r--r--addons/document/document.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index 27a6c3d3c19..90f57438ce8 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -49,6 +49,7 @@ class document_file(osv.osv):
It also establishes the parent_id NOT NULL constraint that ir.attachment
should have had (but would have failed if plain attachments contained null
values).
+ It also updates the File Size for the previously created attachments.
"""
parent_id = self.pool.get('document.directory')._get_root_directory(cr,uid)
@@ -62,7 +63,11 @@ class document_file(osv.osv):
cr.execute("UPDATE ir_attachment " \
"SET parent_id = %s, db_datas = decode(encode(db_datas,'escape'), 'base64') " \
"WHERE parent_id IS NULL", (parent_id,))
+
+ cr.execute("UPDATE ir_attachment SET file_size=length(db_datas) WHERE file_size = 0;")
+
cr.execute("ALTER TABLE ir_attachment ALTER parent_id SET NOT NULL")
+
return True
def _get_filestore(self, cr):