[Erp5-report] r40542 nicolas - /erp5/trunk/products/ERP5OOo/FormPrintout.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 23 15:10:32 CET 2010


Author: nicolas
Date: Tue Nov 23 15:10:28 2010
New Revision: 40542

URL: http://svn.erp5.org?rev=40542&view=rev
Log:
Add new parameter to let user choose the template if wants to use.

Modified:
    erp5/trunk/products/ERP5OOo/FormPrintout.py

Modified: erp5/trunk/products/ERP5OOo/FormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/FormPrintout.py?rev=40542&r1=40541&r2=40542&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] Tue Nov 23 15:10:28 2010
@@ -189,7 +189,8 @@ class FormPrintout(Implicit, Persistent,
     self.filename = filename
 
   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.
 
     format: conversion format requested by User.
@@ -205,9 +206,13 @@ class FormPrintout(Implicit, Persistent,
       else:
         container = None
     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'
-    printout_template = getattr(obj, self.template)
 
     report_method = None
     if hasattr(form, 'report_method'):




More information about the Erp5-report mailing list