From d45c78dc4b023514e05912d0dbb353ebdf7aedf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Tue, 17 Jun 2008 08:39:09 +0000 Subject: [PATCH] Previously, if ratio was set to 0 or None on a model line, it was assumed that the ratio was 100%. We want to separate it in two different cases: - ratio is 0 -> the line should not be created. - ratio is not set (ie. None) -> this means that no ratio apply here, it's a simple amount, so ratio default to 100% Move this in the default calculation script so that it's possible to change the behaviour. Add tests for those two cases (price = None and price = 0) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21633 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../PaySheetTransaction_defaultCalculationScript.xml | 8 +++++--- bt5/erp5_payroll/bt/revision | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_defaultCalculationScript.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_defaultCalculationScript.xml index 9be2fc98ca..8722a7d665 100644 --- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_defaultCalculationScript.xml +++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_defaultCalculationScript.xml @@ -69,8 +69,10 @@ precision = context.getPriceCurrencyValue().getQuantityPrecision()\n \n -quantity = cell.getQuantity() or 0\n -price = cell.getPrice() or 0\n +quantity = cell.getQuantity()\n +price = cell.getPrice()\n +if price is None:\n + price = 1\n \n model_line = cell.getParentValue()\n \n @@ -181,13 +183,13 @@ return {\'quantity\':quantity, \'price\':price}\n <string>precision</string> <string>quantity</string> <string>price</string> + <string>None</string> <string>model_line</string> <string>dict</string> <string>base_application</string> <string>tax_category_list</string> <string>_getitem_</string> <string>tax_category</string> - <string>None</string> <string>_getiter_</string> <string>base</string> <string>_inplacevar_</string> diff --git a/bt5/erp5_payroll/bt/revision b/bt5/erp5_payroll/bt/revision index e6d11f621d..6eac4a65cd 100644 --- a/bt5/erp5_payroll/bt/revision +++ b/bt5/erp5_payroll/bt/revision @@ -1 +1 @@ -291 \ No newline at end of file +292 \ No newline at end of file -- 2.30.9