summaryrefslogtreecommitdiff
path: root/addons/document/directory_content.py
diff options
context:
space:
mode:
authorHarry (OpenERP) <hmo@tinyerp.com>2010-07-20 18:35:13 +0530
committerHarry (OpenERP) <hmo@tinyerp.com>2010-07-20 18:35:13 +0530
commit77f62a88a314a905e5ffc73cffd72d68ddfe33db (patch)
treeedc70351000fba9ea5a4ab27a3f680c5844e9e82 /addons/document/directory_content.py
parent90234707dc901a81935570274c52a5327940b66e (diff)
parent1eea693ecadd3829fa729a727a154c23a1df6ab6 (diff)
[MERGE] merged new api of document module
bzr revid: hmo@tinyerp.com-20100720130513-3t2cbyvns3hlj6qn
Diffstat (limited to 'addons/document/directory_content.py')
-rw-r--r--addons/document/directory_content.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/addons/document/directory_content.py b/addons/document/directory_content.py
index 2d434712f56..bec4f25e45d 100644
--- a/addons/document/directory_content.py
+++ b/addons/document/directory_content.py
@@ -58,7 +58,9 @@ class document_directory_content(osv.osv):
'suffix': fields.char('Suffix', size=16),
'report_id': fields.many2one('ir.actions.report.xml', 'Report'),
'extension': fields.selection(_extension_get, 'Document Type', required=True, size=4),
- 'include_name': fields.boolean('Include Record Name', help="Check this field if you want that the name of the file start by the record name."),
+ 'include_name': fields.boolean('Include Record Name',
+ help="Check this field if you want that the name of the file to contain the record name." \
+ "\nIf set, the directory will have to be a resource one."),
'directory_id': fields.many2one('document.directory', 'Directory'),
}
_defaults = {
@@ -88,12 +90,19 @@ class document_directory_content(osv.osv):
tname = (content.prefix or '') + (content.suffix or '') + (content.extension or '')
if tname.find('/'):
tname=tname.replace('/', '_')
+ act_id = False
+ if 'dctx_res_id' in node.dctx:
+ act_id = node.dctx['dctx_res_id']
+ elif hasattr(node, 'res_id'):
+ act_id = node.res_id
+ else:
+ act_id = node.context.context.get('res_id',False)
if not nodename:
- n = nodes.node_content(tname, node, node.context,content)
+ n = nodes.node_content(tname, node, node.context,content, act_id=act_id)
res2.append( n)
else:
if nodename == tname:
- n = nodes.node_content(tname, node, node.context,content)
+ n = nodes.node_content(tname, node, node.context,content, act_id=act_id)
n.fill_fields(cr)
res2.append(n)
return res2
@@ -108,6 +117,10 @@ class document_directory_content(osv.osv):
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']], {}, {})
+ ctx = node.context.context.copy()
+ ctx.update(node.dctx)
+ pdf,pdftype = srv.create(cr, uid, [node.act_id,], {}, context=ctx)
return pdf
document_directory_content()
+
+#eof \ No newline at end of file