[REF] Document
bzr revid: jvo@tinyerp.com-20100906104054-cucn9vpywxyum3oo
This commit is contained in:
@@ -20,9 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
import os
|
||||
|
||||
# from psycopg2 import Binary
|
||||
@@ -48,12 +46,12 @@ class document_file(osv.osv):
|
||||
result = {}
|
||||
bin_size = context.get('bin_size', False)
|
||||
for fbro in fbrl:
|
||||
fnode = nodes.node_file(None, None, nctx, fbro)
|
||||
if not bin_size:
|
||||
data = fnode.get_data(cr, fbro)
|
||||
result[fbro.id] = base64.encodestring(data or '')
|
||||
else:
|
||||
result[fbro.id] = fnode.get_data_len(cr, fbro)
|
||||
fnode = nodes.node_file(None, None, nctx, fbro)
|
||||
if not bin_size:
|
||||
data = fnode.get_data(cr, fbro)
|
||||
result[fbro.id] = base64.encodestring(data or '')
|
||||
else:
|
||||
result[fbro.id] = fnode.get_data_len(cr, fbro)
|
||||
|
||||
return result
|
||||
|
||||
@@ -166,7 +164,6 @@ class document_file(osv.osv):
|
||||
dbro = None
|
||||
dnode = None
|
||||
ids2 = []
|
||||
result = False
|
||||
for fbro in self.browse(cr, uid, ids, context=context):
|
||||
if ('parent_id' not in vals or fbro.parent_id.id == vals['parent_id']) \
|
||||
and ('name' not in vals or fbro.name == vals['name']) :
|
||||
@@ -193,7 +190,7 @@ class document_file(osv.osv):
|
||||
return result
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if not context:
|
||||
if context is None:
|
||||
context = {}
|
||||
vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
|
||||
if not vals['parent_id']:
|
||||
|
||||
Reference in New Issue
Block a user