Commit 5e5aeaf8 authored by Jérome Perrin's avatar Jérome Perrin

use conflict-free id generator

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29685 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 64bb175d
......@@ -62,12 +62,14 @@ transaction = state_change[\'object\']\n
source_section = transaction.getSourceSection()\n
destination_section = transaction.getDestinationSection()\n
\n
id_generator = state_change.getPortal().portal_ids.generateNewLengthId\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 = transaction.generateNewId(id_group=invoice_id_group,\n
default=1)\n
invoice_reference = id_generator(id_group=invoice_id_group,\n
default=1)\n
transaction.setReference(invoice_reference)\n
\n
\n
......@@ -80,8 +82,7 @@ if not transaction.getSourceReference():\n
if not period_code:\n
period_code = str(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
source_reference = id_generator(id_group=source_id_group, default=1)\n
transaction.setSourceReference(\'%s-%s\' % (period_code, source_reference))\n
\n
if not transaction.getDestinationReference():\n
......@@ -92,8 +93,7 @@ if not transaction.getDestinationReference():\n
if not period_code:\n
period_code = str(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
destination_reference = id_generator(id_group=destination_id_group, default=1)\n
transaction.setDestinationReference(\'%s-%s\' % (period_code, destination_reference))\n
</string> </value>
</item>
......@@ -145,6 +145,7 @@ if not transaction.getDestinationReference():\n
<string>_getattr_</string>
<string>source_section</string>
<string>destination_section</string>
<string>id_generator</string>
<string>invoice_id_group</string>
<string>invoice_reference</string>
<string>period</string>
......
989
\ No newline at end of file
990
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment