Commit 9f27ecdf authored by Nicolas Delaby's avatar Nicolas Delaby

Add new parameter to let user choose the template if wants to use.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40542 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5afd8512
...@@ -189,7 +189,8 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item, PropertyManager): ...@@ -189,7 +189,8 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item, PropertyManager):
self.filename = filename self.filename = filename
security.declareProtected('View', 'index_html') security.declareProtected('View', 'index_html')
def index_html(self, REQUEST, RESPONSE=None, format=None, batch_mode=False): def index_html(self, REQUEST, RESPONSE=None, template_relative_url=None,
format=None, batch_mode=False):
"""Render and view a printout document. """Render and view a printout document.
format: conversion format requested by User. format: conversion format requested by User.
...@@ -205,9 +206,13 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item, PropertyManager): ...@@ -205,9 +206,13 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item, PropertyManager):
else: else:
container = None container = None
form = getattr(obj, self.form_name) form = getattr(obj, self.form_name)
if self.template is None or self.template == '': if template_relative_url:
printout_template = obj.getPortalObject().\
restrictedTraverse(template_relative_url)
elif self.template:
printout_template = getattr(obj, self.template)
else:
raise ValueError, 'Can not create a ODF Document without a printout template' raise ValueError, 'Can not create a ODF Document without a printout template'
printout_template = getattr(obj, self.template)
report_method = None report_method = None
if hasattr(form, 'report_method'): if hasattr(form, 'report_method'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment