[FIX] document, document_ics, document_ftp : solved problem to read content data
bzr revid: hmo@tinyerp.com-20091217132231-a4zcin2lvd2qjjsn
This commit is contained in:
@@ -98,18 +98,16 @@ class document_directory_content(osv.osv):
|
||||
res2.append(n)
|
||||
return res2
|
||||
|
||||
def process_write(self, cr, uid, node, data):
|
||||
def process_write(self, cr, uid, node, data, context=None):
|
||||
if node.extension != '.pdf':
|
||||
raise Exception("Invalid content: %s" % node.extension)
|
||||
return True
|
||||
|
||||
def process_read(self, cr, uid, node):
|
||||
def process_read(self, cr, uid, node, context=None):
|
||||
if node.extension != '.pdf':
|
||||
raise Exception("Invalid content: %s" % node.extension)
|
||||
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, node.report_id)
|
||||
srv = netsvc.Service._services['report.'+report.report_name]
|
||||
pdf,pdftype = srv.create(cr, uid, [node.context.context['res_id']], {}, {})
|
||||
s = StringIO.StringIO(pdf)
|
||||
s.name = node
|
||||
return s
|
||||
pdf,pdftype = srv.create(cr, uid, [node.context.context['res_id']], {}, {})
|
||||
return pdf
|
||||
document_directory_content()
|
||||
|
||||
@@ -328,10 +328,10 @@ class abstracted_fs:
|
||||
cr = pooler.get_db(node.context.dbname).cursor()
|
||||
pool = pooler.get_pool(node.context.dbname)
|
||||
res = getattr(pool.get('document.directory.content'), 'process_read')(cr, uid, node)
|
||||
cr.close()
|
||||
s = StringIO.StringIO(res)
|
||||
s.name = node
|
||||
return s
|
||||
res = StringIO.StringIO(res)
|
||||
res.name = node
|
||||
cr.close()
|
||||
return res
|
||||
else:
|
||||
raise OSError(1, 'Operation not permited.')
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ class document_directory_content(osv.osv):
|
||||
|
||||
def process_write(self, cr, uid, node, data, context=None):
|
||||
if node.extension != '.ics':
|
||||
return super(document_directory_content).process_write(cr, uid, node, data, context)
|
||||
return super(document_directory_content, self).process_write(cr, uid, node, data, context)
|
||||
import vobject
|
||||
parsedCal = vobject.readOne(data)
|
||||
fields = {}
|
||||
@@ -245,7 +245,7 @@ class document_directory_content(osv.osv):
|
||||
return datetime.datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
|
||||
|
||||
if node.extension != '.ics':
|
||||
return super(document_directory_content).process_read(cr, uid, node, context)
|
||||
return super(document_directory_content, self).process_read(cr, uid, node, context)
|
||||
|
||||
import vobject
|
||||
ctx = (context or {})
|
||||
@@ -253,7 +253,7 @@ class document_directory_content(osv.osv):
|
||||
ctx.update(node.dctx)
|
||||
content = self.browse(cr, uid, node.cnt_id, ctx)
|
||||
if not content.object_id:
|
||||
return super(document_directory_content).process_read(cr, uid, node, context)
|
||||
return super(document_directory_content, self).process_read(cr, uid, node, context)
|
||||
obj_class = self.pool.get(content.object_id.model)
|
||||
|
||||
if content.ics_domain:
|
||||
@@ -294,8 +294,7 @@ class document_directory_content(osv.osv):
|
||||
else:
|
||||
value = ics_datetime(value)
|
||||
event.add(field.name).value = value
|
||||
s= cal.serialize()
|
||||
cr.commit()
|
||||
s = cal.serialize()
|
||||
return s
|
||||
document_directory_content()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user