[Erp5-report] r13982 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 5 16:34:13 CEST 2007


Author: jerome
Date: Thu Apr  5 16:34:11 2007
New Revision: 13982

URL: http://svn.erp5.org?rev=13982&view=rev
Log:
Base_getAccountingPeriodStartDateForSectionCategory:
  a new script to guess the start date of the current period (based on the
  date parameter) for a section_category.
AccountModule_getTrialBalanceReportSectionList:
  use Base_getAccountingPeriodStartDateForSectionCategory


Added:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml
Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.xml?rev=13982&r1=13981&r2=13982&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.xml Thu Apr  5 16:34:11 2007
@@ -68,9 +68,7 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-""" Trial balance.\n
+            <value> <string>""" Trial balance.\n
 """\n
 from Products.ERP5Form.Report import ReportSection\n
 \n
@@ -86,22 +84,10 @@
 \n
 section_uid = portal.Base_getSectionUidListForSectionCategory(\n
                                    request[\'section_category\'])\n
-# XXX for now we guess period start date from the first organisation having\n
-# accounting periods\n
-period_start_date = None\n
-valid_accounting_period = dict(portal_type=\'Accounting Period\',\n
-                               simulation_state=(\'planned\', \'confirmed\',\n
-                                      \'stopped\', \'closing\', \'delivered\'))\n
-date = from_date or at_date\n
-for uid in section_uid:\n
-  section = portal.portal_catalog.getObject(uid)\n
-  for ap in section.contentValues(filter=valid_accounting_period):\n
-    if ap.getStartDate() <= date <= ap.getStopDate():\n
-      period_start_date = ap.getStartDate().earliestTime()\n
-  if period_start_date:\n
-    break\n
-else:\n
-  period_start_date = DateTime(date.year(), 1, 1)\n
+\n
+period_start_date = portal.Base_getAccountingPeriodStartDateForSectionCategory(\n
+         section_category=request[\'section_category\'], date=from_date or at_date)\n
+# for the report summary\n
 request.set(\'period_start_date\', period_start_date)\n
 \n
 if not from_date:\n
@@ -133,9 +119,7 @@
                                   section_uid=section_uid,\n
                                   simulation_state=simulation_state,\n
                                   precision=precision ),) ]\n
-
-
-]]></string> </value>
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -200,17 +184,10 @@
                             <string>show_empty_accounts</string>
                             <string>section_uid</string>
                             <string>period_start_date</string>
-                            <string>dict</string>
-                            <string>valid_accounting_period</string>
-                            <string>date</string>
-                            <string>_getiter_</string>
-                            <string>uid</string>
-                            <string>section</string>
-                            <string>ap</string>
-                            <string>DateTime</string>
                             <string>currency</string>
                             <string>precision</string>
                             <string>True</string>
+                            <string>dict</string>
                           </tuple>
                         </value>
                     </item>

Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml?rev=13982&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml Thu Apr  5 16:34:11 2007
@@ -1,0 +1,179 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+from Products.ERP5Type.Cache import CachingMethod\n
+\n
+def getAccountingPeriodStartDateForSectionCategory(section_category, date):\n
+  portal = context.getPortalObject()\n
+  section_uid = portal.Base_getSectionUidListForSectionCategory(\n
+                                      section_category)\n
+  # XXX for now we guess period start date from the first organisation having\n
+  # accounting periods\n
+  period_start_date = None\n
+  valid_accounting_period = dict(portal_type=\'Accounting Period\',\n
+                                 simulation_state=(\'planned\', \'confirmed\',\n
+                                        \'stopped\', \'closing\', \'delivered\'))\n
+  for uid in section_uid:\n
+    section = portal.portal_catalog.getObject(uid)\n
+    for ap in section.contentValues(filter=valid_accounting_period):\n
+      if ap.getStartDate() <= date <= ap.getStopDate():\n
+        period_start_date = ap.getStartDate().earliestTime()\n
+    if period_start_date:\n
+      break\n
+  else:\n
+    period_start_date = DateTime(date.year(), 1, 1)\n
+  return period_start_date\n
+\n
+getAccountingPeriodStartDateForSectionCategory = CachingMethod(\n
+              getAccountingPeriodStartDateForSectionCategory,\n
+              id=script.getId(), cache_factory=\'erp5_content_long\')\n
+\n
+return getAccountingPeriodStartDateForSectionCategory(section_category, date)\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>section_category, date</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>2</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>section_category</string>
+                            <string>date</string>
+                            <string>Products.ERP5Type.Cache</string>
+                            <string>CachingMethod</string>
+                            <string>getAccountingPeriodStartDateForSectionCategory</string>
+                            <string>_getattr_</string>
+                            <string>script</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_getAccountingPeriodStartDateForSectionCategory</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=13982&r1=13981&r2=13982&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Thu Apr  5 16:34:11 2007
@@ -1,1 +1,1 @@
-242
+243




More information about the Erp5-report mailing list