From 5e4c032c73e5939321f7af57b129328116108391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 2 May 2007 10:24:29 +0000 Subject: [PATCH] Add a at_date parameter to Invoice_getRemainingTotalPayablePrice, to ignore payments after this date. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14296 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Invoice_getRemainingTotalPayablePrice.xml | 15 +++++++++++++-- bt5/erp5_accounting/bt/revision | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml index 4fb0582973..54c9d98277 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml @@ -76,6 +76,9 @@ For this, we use both causality relation between transactions and grouping\n reference for lines.\n If `detailed` argument is set to a true value, instead of returning the price\n as a float value, it returns a mapping (node, mirror_section) -> total_price.\n +The `at_date` paremeter is when you want to know the remaining amount at a\n +particuliar date. This simply ignores related payments or transactions after\n +this date.\n """\n portal = context.getPortalObject()\n total_payable_price_per_node_section = dict()\n @@ -109,6 +112,7 @@ for line in context.getMovementList(\n line_section = line.getDestinationSection()\n mirror_section = line.getSourceSection()\n amount = line.getDestinationInventoriatedTotalAssetPrice() or 0\n +\n \n if node_value is not None and \\\n node_value.getAccountTypeId() in (\'payable\', \'receivable\'):\n @@ -160,14 +164,18 @@ for related_transaction in context.getCausalityRelatedValueList(\n line_section = line.getSourceSection()\n mirror_section = line.getDestinationSection()\n amount = line.getSourceInventoriatedTotalAssetPrice() or 0\n + date = line.getStartDate().earliestTime()\n else:\n node_value = line.getDestinationValue(portal_type=\'Account\')\n line_section = line.getDestinationSection()\n mirror_section = line.getSourceSection()\n amount = line.getDestinationInventoriatedTotalAssetPrice() or 0\n + date = line.getStopDate().earliestTime()\n \n if node_value is not None and \\\n node_value.getAccountTypeId() in (\'payable\', \'receivable\'):\n + if at_date and date > at_date:\n + continue\n if node_value in accounts_in_context:\n key = (node_value.getRelativeUrl(), mirror_section)\n total_payable_price_per_node_section[key] =\\\n @@ -201,7 +209,7 @@ else:\n </item> <item> <key> <string>_params</string> </key> - <value> <string>detailed=0</string> </value> + <value> <string>detailed=0, at_date=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -221,13 +229,14 @@ else:\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>1</int> </value> + <value> <int>2</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> <string>detailed</string> + <string>at_date</string> <string>_getattr_</string> <string>context</string> <string>portal</string> @@ -256,6 +265,7 @@ else:\n <string>other_invoice_line_account</string> <string>ValueError</string> <string>related_transaction_is_source</string> + <string>date</string> <string>sum</string> </tuple> </value> @@ -270,6 +280,7 @@ else:\n <value> <tuple> <int>0</int> + <none/> </tuple> </value> </item> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index eff3954851..6eac4a65cd 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -290 \ No newline at end of file +292 \ No newline at end of file -- 2.30.9