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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 5 12:46:36 CET 2008


Author: jerome
Date: Wed Mar  5 12:46:36 2008
New Revision: 19693

URL: http://svn.erp5.org?rev=19693&view=rev
Log:
Generate transaction references using the short title on the corresponding accounting period.
Introduce new scripts to get the accounting period that apply for an accounting transaction

Added:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view/my_short_title.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForDestinationSection.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForSourceSection.xml
Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view.xml
    erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view.xml?rev=19693&r1=19692&r2=19693&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view.xml Wed Mar  5 12:46:36 2008
@@ -83,6 +83,7 @@
                         <string>my_title</string>
                         <string>my_start_date</string>
                         <string>my_stop_date</string>
+                        <string>my_short_title</string>
                       </list>
                     </value>
                 </item>

Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view/my_short_title.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view/my_short_title.xml?rev=19693&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view/my_short_title.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_view/my_short_title.xml Wed Mar  5 12:46:36 2008
@@ -1,0 +1,104 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>title</string>
+                <string>description</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_short_title</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key>                 <string>description</string> </key>
+                    <value> <string>A short identifier for this accounting period. This will be used to generate references in accounting transactions.</string> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_string_field</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key>                 <string>title</string> </key>
+                    <value> <string>Short Title</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForDestinationSection.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForDestinationSection.xml?rev=19693&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForDestinationSection.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForDestinationSection.xml Wed Mar  5 12:46:36 2008
@@ -1,0 +1,168 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </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[
+
+"""Returns the accounting period for the destination section that should be applied for this\n
+accounting transaction.\n
+"""\n
+\n
+operation_date = context.getStopDate()\n
+if not operation_date:\n
+  return None\n
+\n
+section = context.getDestinationSectionValue(portal_type=\'Organisation\')\n
+if section is not None:\n
+  for accounting_period in section.contentValues(\n
+                          portal_type=\'Accounting Period\',\n
+                          checked_permission=\'View\'):\n
+    if accounting_period.getValidationState() in (\n
+              \'draft\', \'cancelled\', \'deleted\'):\n
+      continue\n
+    if accounting_period.getStartDate().earliestTime()\\\n
+              <=  operation_date <= \\\n
+       accounting_period.getStopDate().latestTime():\n
+      return accounting_period\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></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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+<string>context</string>
+                            <string>operation_date</string>
+                            <string>None</string>
+                            <string>section</string>
+                            <string>_getiter_</string>
+                            <string>accounting_period</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>AccountingTransaction_getAccountingPeriodForDestinationSection</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForSourceSection.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForSourceSection.xml?rev=19693&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForSourceSection.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingPeriodForSourceSection.xml Wed Mar  5 12:46:36 2008
@@ -1,0 +1,168 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </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[
+
+"""Returns the accounting period for the source section that should be applied for this\n
+accounting transaction.\n
+"""\n
+\n
+operation_date = context.getStartDate()\n
+if not operation_date:\n
+  return None\n
+\n
+section = context.getSourceSectionValue(portal_type=\'Organisation\')\n
+if section is not None:\n
+  for accounting_period in section.contentValues(\n
+                          portal_type=\'Accounting Period\',\n
+                          checked_permission=\'View\'):\n
+    if accounting_period.getValidationState() in (\n
+              \'draft\', \'cancelled\', \'deleted\'):\n
+      continue\n
+    if accounting_period.getStartDate().earliestTime()\\\n
+              <=  operation_date <= \\\n
+       accounting_period.getStopDate().latestTime():\n
+      return accounting_period\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></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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+<string>context</string>
+                            <string>operation_date</string>
+                            <string>None</string>
+                            <string>section</string>
+                            <string>_getiter_</string>
+                            <string>accounting_period</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>AccountingTransaction_getAccountingPeriodForSourceSection</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml?rev=19693&r1=19692&r2=19693&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml Wed Mar  5 12:46:36 2008
@@ -82,20 +82,31 @@
                                                   default=1)\n
     transaction.setReference(invoice_reference)\n
 \n
+\n
 # Generate new values for Source Reference and Destination Reference.\n
 if not transaction.getSourceReference():\n
-  year = transaction.getStartDate().year()\n
-  source_id_group = (\'accounting\', \'section\', source_section, year)\n
+  period = transaction.AccountingTransaction_getAccountingPeriodForSourceSection()\n
+  period_code = \'\'\n
+  if period is not None:\n
+    period_code = period.getShortTitle() or period.getTitle() or \'\'\n
+  if not period_code:\n
+    period_code = transaction.getStartDate().year()\n
+  source_id_group = (\'accounting\', \'section\', source_section, period_code)\n
   source_reference = transaction.generateNewId(id_group=source_id_group,\n
                                                default=1)\n
-  transaction.setSourceReference(\'%s-%s\' % (year, source_reference))\n
+  transaction.setSourceReference(\'%s-%s\' % (period_code, source_reference))\n
 \n
 if not transaction.getDestinationReference():\n
-  year = transaction.getStopDate().year()\n
-  destination_id_group = (\'accounting\', \'section\', destination_section, year)\n
+  period = transaction.AccountingTransaction_getAccountingPeriodForDestinationSection()\n
+  period_code = \'\'\n
+  if period is not None:\n
+    period_code = period.getShortTitle() or period.getTitle() or \'\'\n
+  if not period_code:\n
+    period_code = transaction.getStopDate().year()\n
+  destination_id_group = (\'accounting\', \'section\', destination_section, period_code)\n
   destination_reference = transaction.generateNewId(\n
                               id_group=destination_id_group, default=1)\n
-  transaction.setDestinationReference(\'%s-%s\' % (year, destination_reference))\n
+  transaction.setDestinationReference(\'%s-%s\' % (period_code, destination_reference))\n
 </string> </value>
         </item>
         <item>
@@ -152,7 +163,9 @@
                             <string>destination_section</string>
                             <string>invoice_id_group</string>
                             <string>invoice_reference</string>
-                            <string>year</string>
+                            <string>period</string>
+                            <string>period_code</string>
+                            <string>None</string>
                             <string>source_id_group</string>
                             <string>source_reference</string>
                             <string>destination_id_group</string>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=19693&r1=19692&r2=19693&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Wed Mar  5 12:46:36 2008
@@ -1,1 +1,1 @@
-630
+631




More information about the Erp5-report mailing list