[MERGE]
[odoo/odoo.git] / addons / document / directory_content.py
index bec4f25..5b8ec3d 100644 (file)
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
 #
 ##############################################################################
-import base64
 
 from osv import osv, fields
-from osv.orm import except_orm
-import urlparse
 
 import netsvc
-import os
+# import os
 import nodes
-import StringIO
+# import StringIO
 
 class document_directory_content_type(osv.osv):
     _name = 'document.directory.content.type'
@@ -47,7 +44,7 @@ class document_directory_content(osv.osv):
     _name = 'document.directory.content'
     _description = 'Directory Content'
     _order = "sequence"
-    def _extension_get(self, cr, uid, context={}):
+    def _extension_get(self, cr, uid, context=None):
         cr.execute('select code,name from document_directory_content_type where active')
         res = cr.fetchall()
         return res
@@ -83,7 +80,7 @@ class document_directory_content(osv.osv):
         tname = ''
         if content.include_name:
             content_name = node.displayname or ''
-            obj = node.context._dirobj.pool.get(model)
+            # obj = node.context._dirobj.pool.get(model)
             if content_name:
                 tname = (content.prefix or '') + content_name + (content.suffix or '') + (content.extension or '')
         else:
@@ -115,7 +112,7 @@ class document_directory_content(osv.osv):
     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)
+        report = self.pool.get('ir.actions.report.xml').browse(cr, uid, node.report_id, context=context)
         srv = netsvc.Service._services['report.'+report.report_name]
         ctx = node.context.context.copy()
         ctx.update(node.dctx)
@@ -123,4 +120,5 @@ class document_directory_content(osv.osv):
         return pdf
 document_directory_content()
 
-#eof
\ No newline at end of file
+#eof
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: