From 71fdf7b58d16aad40c10213c3e99509ae98e97dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 21 Jan 2010 13:32:40 +0000 Subject: [PATCH] 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 --- .../AccountingPeriod_createBalanceTransaction.xml | 11 ++++++++++- bt5/erp5_accounting/bt/revision | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml index 31c40637d3..11bee6bfe7 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml @@ -71,6 +71,7 @@ def roundCurrency(value, resource_relative_url):\n return round(value, qty_precision)\n \n activity_tag = \'BalanceTransactionCreation\'\n +activate_kw=dict(tag=activity_tag)\n \n at_date = context.getStopDate()\n assert at_date\n @@ -88,7 +89,7 @@ for section_uid in \\\n section = portal.portal_catalog.getObject(uid=section_uid)\n \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 start_date=(at_date + 1).earliestTime(),\n title=context.getTitle() or Base_translateString(\'Balance Transaction\'),\n @@ -152,6 +153,7 @@ for section_uid in \\\n balance_transaction.newContent(\n id=\'%03d\' % line_count,\n portal_type=\'Balance Transaction Line\',\n + activate_kw=activate_kw,\n destination=inventory.node_relative_url,\n resource=inventory.resource_relative_url,\n quantity=quantity,\n @@ -168,6 +170,7 @@ for section_uid in \\\n balance_transaction.newContent(\n id=\'%03d\' % line_count,\n portal_type=\'Balance Transaction Line\',\n + activate_kw=activate_kw,\n destination=inventory.node_relative_url,\n quantity=total_price)\n \n @@ -192,6 +195,7 @@ for section_uid in \\\n balance_transaction.newContent(\n id=\'%03d\' % line_count,\n portal_type=\'Balance Transaction Line\',\n + activate_kw=activate_kw,\n destination=inventory.node_relative_url,\n source_section_uid=inventory.mirror_section_uid,\n resource=inventory.resource_relative_url,\n @@ -204,6 +208,7 @@ for section_uid in \\\n balance_transaction.newContent(\n id=\'%03d\' % line_count,\n portal_type=\'Balance Transaction Line\',\n + activate_kw=activate_kw,\n destination=inventory.node_relative_url,\n source_section_uid=inventory.mirror_section_uid,\n quantity=total_price)\n @@ -230,6 +235,7 @@ for section_uid in \\\n balance_transaction.newContent(\n id=\'%03d\' % line_count,\n portal_type=\'Balance Transaction Line\',\n + activate_kw=activate_kw,\n destination=inventory.node_relative_url,\n resource=inventory.resource_relative_url,\n quantity=quantity,\n @@ -242,6 +248,7 @@ for section_uid in \\\n balance_transaction.newContent(\n id=\'%03d\' % line_count,\n portal_type=\'Balance Transaction Line\',\n + activate_kw=activate_kw,\n destination=inventory.node_relative_url,\n destination_payment_uid=inventory.payment_uid,\n quantity=total_price)\n @@ -249,6 +256,7 @@ for section_uid in \\\n # add a final line for p&l\n balance_transaction.newContent(\n id=\'%03d\' % (line_count + 1),\n + activate_kw=activate_kw,\n portal_type=\'Balance Transaction Line\',\n destination=profit_and_loss_account,\n quantity=-profit_and_loss_quantity)\n @@ -307,6 +315,7 @@ context.activate(after_tag=activity_tag).getTitle()\n <string>precision_cache</string> <string>roundCurrency</string> <string>activity_tag</string> + <string>activate_kw</string> <string>at_date</string> <string>AssertionError</string> <string>section</string> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index 3430292e09..1bb2f3ded3 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -1087 \ No newline at end of file +1088 \ No newline at end of file -- 2.30.9