[Erp5-report] r30811 - in /erp5/trunk/bt5/erp5_ods_style: SkinTemplateItem/portal_skins/erp...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 23 14:49:48 CET 2009


Author: jerome
Date: Mon Nov 23 14:49:45 2009
New Revision: 30811

URL: http://svn.erp5.org?rev=30811&view=rev
Log:
calculate column len properly

Modified:
    erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/form_view.xml
    erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.xml
    erp5/trunk/bt5/erp5_ods_style/bt/revision

Modified: erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/form_view.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/form_view.xml?rev=30811&r1=30810&r2=30811&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/form_view.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/form_view.xml [utf8] Mon Nov 23 14:49:45 2009
@@ -55,19 +55,6 @@
   <tal:block metal:use-macro="here/style_macros/macros/style_macro"/>\n
 <office:body>\n
   <office:spreadsheet>\n
-    <!-- calculate max column len -->\n
-    <tal:block tal:define="field_list python:form.get_fields_in_group(\'bottom\')">\n
-      <tal:block tal:define="global column_len python:3"/>\n
-      <tal:block tal:condition=\'field_list\'>\n
-        <tal:block tal:define="field python:field_list[0]">\n
-          <tal:block tal:condition="python:field.meta_type == \'ListBox\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')">\n
-            <tal:block tal:define="column_list python: field.get_value(\'columns\');\n
-                                   global column_len python: len(column_list)" />\n
-          </tal:block>\n
-        </tal:block>\n
-      </tal:block>\n
-    </tal:block>\n
-\n
     <table:table table:style-name=\'ta1\' table:print=\'false\' tal:attributes="table:name python: unicode(here.getTitle(), \'utf-8\')" i18n:attributes="table:name">\n
       <!-- at least one table-column element is required for ODF to validate -->\n
       <table:table-column\n
@@ -75,6 +62,29 @@
             table:default-cell-style-name=\'report-column-title\'/>\n
 \n
       <tal:block metal:define-macro="form_layout">\n
+\n
+    <!-- if we have other fields to display, calculate max column len, which will be used later to make standard fields (ie. not listbox) using covered cells -->\n
+    <tal:block tal:condition="python: len(form.get_fields()) &gt; 1">\n
+      <tal:block tal:condition="report_item | nothing">\n
+        <tal:block tal:define="global column_len python: report_item.selection_columns and len(report_item.selection_columns) or 0;"/>\n
+      </tal:block>\n
+    <tal:block>\n
+      <tal:block tal:condition="not: column_len | nothing"\n
+                 tal:define="field_list python:form.get_fields_in_group(\'bottom\')"> \n
+        <tal:block tal:define="global column_len python: 5"/>\n
+        <!-- This default is used for the ERP5 Report itself, which often does not contain a listbox directly -->\n
+        <tal:block tal:condition=\'field_list\'>\n
+          <tal:block tal:define="field python:field_list[0]">\n
+            <tal:block tal:condition="python:field.meta_type == \'ListBox\' or (field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')">\n
+              <tal:block tal:define="column_list python: field.get_value(\'columns\');\n
+                                     global column_len python: len(column_list)" />\n
+            </tal:block>\n
+          </tal:block>\n
+        </tal:block>\n
+      </tal:block>\n
+    </tal:block>\n
+    </tal:block>\n
+\n
         <tal:block tal:define="dummy python: request.set(\'here\', here)">\n
           <tal:block tal:repeat="group python: [g for g in form.get_groups() if g not in (\'bottom\', \'hidden\')]">\n
             <tal:block tal:define="field_list python: form.get_fields_in_group(group)">\n
@@ -147,7 +157,7 @@
       </tal:block>\n
     </tal:block>\n
 \n
-   <tal:block tal:repeat="group python: [g for g in form.get_groups() if g not in ( \'hidden\')]">\n
+   <tal:block tal:repeat="group python: [g for g in form.get_groups() if g not in (\'hidden\', )]">\n
       <tal:block tal:define="field_list python: form.get_fields_in_group(group)">\n
         <tal:block tal:condition="python: field_list not in [None, []]">\n
 \n

Modified: erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.xml?rev=30811&r1=30810&r2=30811&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.xml [utf8] Mon Nov 23 14:49:45 2009
@@ -53,9 +53,7 @@
       <tal:block tal:define="rendered_report_item_list rendered_report_item_list | python:[];\n
                              report_item_list python: rendered_report_item_list or [];\n
                              dummy python: request.set(\'here\', here);\n
-                             global sheet_per_reportsection python: int(request.get(\'sheet_per_report_section\', 0));\n
-                             global column_len python: 5">\n
-                             <!-- TODO: calculate column_len based on the first listbox (or selection_column if exists)-->\n
+                             global sheet_per_reportsection python: int(request.get(\'sheet_per_report_section\', 0));">\n
         <tal:block tal:condition="not: report_item_list">\n
           <tal:block tal:condition="python: form.meta_type == \'ERP5 Report\'">\n
             <tal:block tal:define="dummy python: report_item_list.extend(report_method())" />\n

Modified: erp5/trunk/bt5/erp5_ods_style/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/bt/revision?rev=30811&r1=30810&r2=30811&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_ods_style/bt/revision [utf8] Mon Nov 23 14:49:45 2009
@@ -1,1 +1,1 @@
-218
+219




More information about the Erp5-report mailing list