Change the generateNewId for the new API of id tool


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34554 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 84c3d6bf
...@@ -142,10 +142,8 @@ for (node, section, mirror_section), line_info_list in lines_per_node.items():\n ...@@ -142,10 +142,8 @@ for (node, section, mirror_section), line_info_list in lines_per_node.items():\n
total_price = round(total_price, default_currency.getQuantityPrecision())\n total_price = round(total_price, default_currency.getQuantityPrecision())\n
if total_price == 0 or allow_grouping_with_different_quantity:\n if total_price == 0 or allow_grouping_with_different_quantity:\n
id_group = (\'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 previous_default = context.portal_ids.getLastGeneratedId(id_group=id_group, default=0)\n
grouping_reference = portal.portal_ids.generateNewLengthId(\n grouping_reference = portal.portal_ids.generateNewId(id_generator=\'uid\',\n
id_group=id_group,\n id_group=id_group,\n
default=previous_default + 1)\n default=previous_default + 1)\n
\n \n
......
...@@ -75,16 +75,17 @@ if destination_section_value is not None \\\n ...@@ -75,16 +75,17 @@ if destination_section_value is not None \\\n
destination_section_value.Organisation_getMappingRelatedOrganisation()\n destination_section_value.Organisation_getMappingRelatedOrganisation()\n
destination_section = destination_section_value.getRelativeUrl()\n destination_section = destination_section_value.getRelativeUrl()\n
\n \n
id_generator = state_change.getPortal().portal_ids.generateNewLengthId\n id_generator = state_change.getPortal().portal_ids.generateNewId\n
previous_id_getter = state_change.getPortal().portal_ids.getLastGeneratedId\n previous_id_getter = state_change.getPortal().portal_ids.getLastGeneratedId\n
\n \n
# Invoice Reference is automatically filled only for Sale Invoice Transaction.\n # Invoice Reference is automatically filled only for Sale Invoice Transaction.\n
if transaction.getPortalType() == \'Sale Invoice Transaction\':\n if transaction.getPortalType() == \'Sale Invoice Transaction\':\n
if not transaction.getReference():\n if not transaction.getReference():\n
invoice_id_group = (\'accounting\', \'invoice\', source_section)\n invoice_id_group = (\'accounting\', \'invoice\', source_section)\n
invoice_reference = id_generator(id_group=invoice_id_group,\n invoice_reference = id_generator(id_generator=\'uid\',\n
id_group=invoice_id_group,\n
default=previous_id_getter(invoice_id_group,\n default=previous_id_getter(invoice_id_group,\n
default=0) + 1)\n default=0) + 1)\n
transaction.setReference(invoice_reference)\n transaction.setReference(invoice_reference)\n
\n \n
\n \n
...@@ -97,7 +98,8 @@ if not transaction.getSourceReference():\n ...@@ -97,7 +98,8 @@ if not transaction.getSourceReference():\n
if not period_code:\n if not period_code:\n
period_code = str(transaction.getStartDate().year())\n period_code = str(transaction.getStartDate().year())\n
source_id_group = (\'accounting\', \'section\', source_section, period_code)\n source_id_group = (\'accounting\', \'section\', source_section, period_code)\n
source_reference = id_generator(id_group=source_id_group,\n source_reference = id_generator(id_generator=\'uid\',\n
id_group=source_id_group,\n
default=previous_id_getter(source_id_group,\n default=previous_id_getter(source_id_group,\n
default=0) + 1)\n default=0) + 1)\n
transaction.setSourceReference(\'%s-%s\' % (period_code, source_reference))\n transaction.setSourceReference(\'%s-%s\' % (period_code, source_reference))\n
...@@ -110,9 +112,10 @@ if not transaction.getDestinationReference():\n ...@@ -110,9 +112,10 @@ if not transaction.getDestinationReference():\n
if not period_code:\n if not period_code:\n
period_code = str(transaction.getStopDate().year())\n period_code = str(transaction.getStopDate().year())\n
destination_id_group = (\'accounting\', \'section\', destination_section, period_code)\n destination_id_group = (\'accounting\', \'section\', destination_section, period_code)\n
destination_reference = id_generator(id_group=destination_id_group,\n destination_reference = id_generator(id_generator=\'uid\',\n
id_group=destination_id_group,\n
default=previous_id_getter(destination_id_group,\n default=previous_id_getter(destination_id_group,\n
default=0) + 1)\n default=0) + 1)\n
transaction.setDestinationReference(\'%s-%s\' % (period_code, destination_reference))\n transaction.setDestinationReference(\'%s-%s\' % (period_code, destination_reference))\n
</string> </value> </string> </value>
</item> </item>
......
1176 1177
\ 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