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

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 24 11:36:20 CET 2009


Author: jerome
Date: Tue Nov 24 11:36:20 2009
New Revision: 30839

URL: http://svn.erp5.org?rev=30839&view=rev
Log:
use portal_ids.generateNewLengthId with compatibility with previous storage

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_guessGroupedLines.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/AccountingTransaction_guessGroupedLines.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_guessGroupedLines.xml?rev=30839&r1=30838&r2=30839&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_guessGroupedLines.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_guessGroupedLines.xml [utf8] Tue Nov 24 11:36:20 2009
@@ -141,9 +141,13 @@
   if default_currency is not None:\n
     total_price = round(total_price, default_currency.getQuantityPrecision())\n
   if total_price == 0 or allow_grouping_with_different_quantity:\n
-    # get a grouping reference id\n
-    grouping_reference = portal.portal_ids.generateNewId(\n
-          (\'grouping_reference\', node, section, mirror_section))\n
+    id_group = (\'grouping_reference\', node, section, mirror_section)\n
+    # before, we where using generateNewId, we are now using generateNewLengthId which\n
+    # is using another storage. Get the last value generated with generateNewId and use it as default.\n
+    previous_default = context.portal_ids.getLastGeneratedId(id_group=id_group, default=0)\n
+    grouping_reference = portal.portal_ids.generateNewLengthId(\n
+                                                  id_group=id_group,\n
+                                                  default=previous_default + 1)\n
     \n
     # convert from int to letters\n
     string_reference = int2letter(grouping_reference)\n
@@ -224,6 +228,8 @@
                             <string>default_currency</string>
                             <string>section_obj</string>
                             <string>round</string>
+                            <string>id_group</string>
+                            <string>previous_default</string>
                             <string>grouping_reference</string>
                             <string>string_reference</string>
                             <string>line_obj</string>

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=30839&r1=30838&r2=30839&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml [utf8] Tue Nov 24 11:36:20 2009
@@ -76,13 +76,15 @@
   destination_section = destination_section_value.getRelativeUrl()\n
 \n
 id_generator = state_change.getPortal().portal_ids.generateNewLengthId\n
+previous_id_getter = state_change.getPortal().portal_ids.getLastGeneratedId\n
 \n
 # Invoice Reference is automatically filled only for Sale Invoice Transaction.\n
 if transaction.getPortalType() == \'Sale Invoice Transaction\':\n
   if not transaction.getReference():\n
     invoice_id_group = (\'accounting\', \'invoice\', source_section)\n
     invoice_reference = id_generator(id_group=invoice_id_group,\n
-                                     default=1)\n
+                                     default=previous_id_getter(invoice_id_group,\n
+                                                                default=0) + 1)\n
     transaction.setReference(invoice_reference)\n
 \n
 \n
@@ -95,7 +97,9 @@
   if not period_code:\n
     period_code = str(transaction.getStartDate().year())\n
   source_id_group = (\'accounting\', \'section\', source_section, period_code)\n
-  source_reference = id_generator(id_group=source_id_group, default=1)\n
+  source_reference = id_generator(id_group=source_id_group,\n
+                                  default=previous_id_getter(source_id_group,\n
+                                                             default=0) + 1)\n
   transaction.setSourceReference(\'%s-%s\' % (period_code, source_reference))\n
 \n
 if not transaction.getDestinationReference():\n
@@ -106,7 +110,9 @@
   if not period_code:\n
     period_code = str(transaction.getStopDate().year())\n
   destination_id_group = (\'accounting\', \'section\', destination_section, period_code)\n
-  destination_reference = id_generator(id_group=destination_id_group, default=1)\n
+  destination_reference = id_generator(id_group=destination_id_group,\n
+                                       default=previous_id_getter(destination_id_group,\n
+                                                                  default=0) + 1)\n
   transaction.setDestinationReference(\'%s-%s\' % (period_code, destination_reference))\n
 </string> </value>
         </item>
@@ -162,6 +168,7 @@
                             <string>destination_section</string>
                             <string>destination_section_value</string>
                             <string>id_generator</string>
+                            <string>previous_id_getter</string>
                             <string>invoice_id_group</string>
                             <string>invoice_reference</string>
                             <string>period</string>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=30839&r1=30838&r2=30839&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] Tue Nov 24 11:36:20 2009
@@ -1,1 +1,1 @@
-1054
+1061




More information about the Erp5-report mailing list