Commit d45c78dc authored by Jérome Perrin's avatar Jérome Perrin

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
parent e4fd4cc3
......@@ -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>
......
291
\ No newline at end of file
292
\ 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