Commit 71fdf7b5 authored by Jérome Perrin's avatar Jérome Perrin

Also pass activate_kw when creating lines.

Honestly, the reason is mainly because each line created will call self.getParentValue().recursiveReindexObject() which becomes incredibly slow when the balance transaction have more than REINDEX_SPLIT_COUNT sub objects.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31875 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 65ad3cf8
...@@ -71,6 +71,7 @@ def roundCurrency(value, resource_relative_url):\n ...@@ -71,6 +71,7 @@ def roundCurrency(value, resource_relative_url):\n
return round(value, qty_precision)\n return round(value, qty_precision)\n
\n \n
activity_tag = \'BalanceTransactionCreation\'\n activity_tag = \'BalanceTransactionCreation\'\n
activate_kw=dict(tag=activity_tag)\n
\n \n
at_date = context.getStopDate()\n at_date = context.getStopDate()\n
assert at_date\n assert at_date\n
...@@ -88,7 +89,7 @@ for section_uid in \\\n ...@@ -88,7 +89,7 @@ for section_uid in \\\n
section = portal.portal_catalog.getObject(uid=section_uid)\n section = portal.portal_catalog.getObject(uid=section_uid)\n
\n \n
balance_transaction = portal.accounting_module.newContent(\n balance_transaction = portal.accounting_module.newContent(\n
activate_kw=dict(tag=activity_tag),\n activate_kw=activate_kw,\n
portal_type=\'Balance Transaction\',\n portal_type=\'Balance Transaction\',\n
start_date=(at_date + 1).earliestTime(),\n start_date=(at_date + 1).earliestTime(),\n
title=context.getTitle() or Base_translateString(\'Balance Transaction\'),\n title=context.getTitle() or Base_translateString(\'Balance Transaction\'),\n
...@@ -152,6 +153,7 @@ for section_uid in \\\n ...@@ -152,6 +153,7 @@ for section_uid in \\\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % line_count,\n id=\'%03d\' % line_count,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
activate_kw=activate_kw,\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
resource=inventory.resource_relative_url,\n resource=inventory.resource_relative_url,\n
quantity=quantity,\n quantity=quantity,\n
...@@ -168,6 +170,7 @@ for section_uid in \\\n ...@@ -168,6 +170,7 @@ for section_uid in \\\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % line_count,\n id=\'%03d\' % line_count,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
activate_kw=activate_kw,\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
quantity=total_price)\n quantity=total_price)\n
\n \n
...@@ -192,6 +195,7 @@ for section_uid in \\\n ...@@ -192,6 +195,7 @@ for section_uid in \\\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % line_count,\n id=\'%03d\' % line_count,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
activate_kw=activate_kw,\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
source_section_uid=inventory.mirror_section_uid,\n source_section_uid=inventory.mirror_section_uid,\n
resource=inventory.resource_relative_url,\n resource=inventory.resource_relative_url,\n
...@@ -204,6 +208,7 @@ for section_uid in \\\n ...@@ -204,6 +208,7 @@ for section_uid in \\\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % line_count,\n id=\'%03d\' % line_count,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
activate_kw=activate_kw,\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
source_section_uid=inventory.mirror_section_uid,\n source_section_uid=inventory.mirror_section_uid,\n
quantity=total_price)\n quantity=total_price)\n
...@@ -230,6 +235,7 @@ for section_uid in \\\n ...@@ -230,6 +235,7 @@ for section_uid in \\\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % line_count,\n id=\'%03d\' % line_count,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
activate_kw=activate_kw,\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
resource=inventory.resource_relative_url,\n resource=inventory.resource_relative_url,\n
quantity=quantity,\n quantity=quantity,\n
...@@ -242,6 +248,7 @@ for section_uid in \\\n ...@@ -242,6 +248,7 @@ for section_uid in \\\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % line_count,\n id=\'%03d\' % line_count,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
activate_kw=activate_kw,\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
destination_payment_uid=inventory.payment_uid,\n destination_payment_uid=inventory.payment_uid,\n
quantity=total_price)\n quantity=total_price)\n
...@@ -249,6 +256,7 @@ for section_uid in \\\n ...@@ -249,6 +256,7 @@ for section_uid in \\\n
# add a final line for p&l\n # add a final line for p&l\n
balance_transaction.newContent(\n balance_transaction.newContent(\n
id=\'%03d\' % (line_count + 1),\n id=\'%03d\' % (line_count + 1),\n
activate_kw=activate_kw,\n
portal_type=\'Balance Transaction Line\',\n portal_type=\'Balance Transaction Line\',\n
destination=profit_and_loss_account,\n destination=profit_and_loss_account,\n
quantity=-profit_and_loss_quantity)\n quantity=-profit_and_loss_quantity)\n
...@@ -307,6 +315,7 @@ context.activate(after_tag=activity_tag).getTitle()\n ...@@ -307,6 +315,7 @@ context.activate(after_tag=activity_tag).getTitle()\n
<string>precision_cache</string> <string>precision_cache</string>
<string>roundCurrency</string> <string>roundCurrency</string>
<string>activity_tag</string> <string>activity_tag</string>
<string>activate_kw</string>
<string>at_date</string> <string>at_date</string>
<string>AssertionError</string> <string>AssertionError</string>
<string>section</string> <string>section</string>
......
1087 1088
\ No newline at end of file \ 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