Commit 596ba452 authored by Aurel's avatar Aurel

add a script to check available inventory

fix forms groups
some script changes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9750 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0a17e3d0
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# check that the amount of `resource` in account `payment` is greater than or equal to `quantity`\n
\n
# returns a dictionnary like : {\'error_code\', \'balance\'}\n
\n
#workflow_id = \'bank_account_workflow\'\n
workflow_correct_state_list = (\'valid\', \'being_modified\', \'validating_modification\')\n
manual_validation_account_category_list = (\'test\',)\n
\n
# First check that the payment account is in an acceptable state\n
#payment_state = context.portal_workflow.getInfoFor(ob=payment, name=\'simulation_state\', wf_id=workflow_id)\n
payment_value = context.restrictedTraverse(payment)\n
payment_state = payment_value.getValidationState()\n
\n
if payment_state not in workflow_correct_state_list :\n
return {\'error_code\':2} # closed account\n
\n
resource = payment_value.getPriceCurrencyValue()\n
\n
if resource is None :\n
raise AttributeError, \'No currency defined on %s\' % payment\n
\n
# Next, check the balance of the account\n
account_balance = resource.getAvailableInventory(payment=payment, src__=src__)\n
context.log("account balance",account_balance)\n
context.log("resource payement", str((resource,payment)))\n
if src__ :\n
return account_balance \n
\n
if account_balance - quantity < 0 :\n
# if payment.getBankAccountType() in manual_validation_account_category_list :\n
# return {\'error_code\':3, \'balance\':account_balance} # manual_validation\n
\n
return {\'error_code\':1, \'balance\':account_balance} # insufficient balance\n
\n
return {\'error_code\':0, \'balance\':account_balance} # ok\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/BankAccount_checkAvailableBalance</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>payment, quantity, src__=0</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>payment</string>
<string>quantity</string>
<string>src__</string>
<string>workflow_correct_state_list</string>
<string>manual_validation_account_category_list</string>
<string>_getattr_</string>
<string>context</string>
<string>payment_value</string>
<string>payment_state</string>
<string>resource</string>
<string>None</string>
<string>AttributeError</string>
<string>account_balance</string>
<string>str</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BankAccount_checkAvailableBalance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -93,7 +93,8 @@ if resource is None :\n ...@@ -93,7 +93,8 @@ if resource is None :\n
\n \n
# Next, check the balance of the account\n # Next, check the balance of the account\n
account_balance = resource.getFutureInventory(payment=payment, src__=src__)\n account_balance = resource.getFutureInventory(payment=payment, src__=src__)\n
#context.log("account balance",account_balance)\n context.log("account balance",account_balance)\n
context.log("resource payement", str((resource,payment)))\n
if src__ :\n if src__ :\n
return account_balance \n return account_balance \n
\n \n
...@@ -179,6 +180,7 @@ return {\'error_code\':0, \'balance\':account_balance} # ok\n ...@@ -179,6 +180,7 @@ return {\'error_code\':0, \'balance\':account_balance} # ok\n
<string>None</string> <string>None</string>
<string>AttributeError</string> <string>AttributeError</string>
<string>account_balance</string> <string>account_balance</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -74,7 +74,9 @@ if date is None:\n ...@@ -74,7 +74,9 @@ if date is None:\n
# get current date\n # get current date\n
from DateTime import DateTime\n from DateTime import DateTime\n
date = DateTime()\n date = DateTime()\n
date = date.Date()\n \n
# Make sure we have a date with no hours\n
date = date.Date()\n
\n \n
if site is None:\n if site is None:\n
# get site from user assignment\n # get site from user assignment\n
......
...@@ -95,7 +95,7 @@ base_category_list = (\'emission_letter\', \'cash_status\', \'variation\')\n ...@@ -95,7 +95,7 @@ base_category_list = (\'emission_letter\', \'cash_status\', \'variation\')\n
per_resource_dict = {}\n per_resource_dict = {}\n
\n \n
# remove previous line\n # remove previous line\n
old_line = [x.getObject() for x in context.searchFolder(portal_type=[line_portal_type,])]\n old_line = context.objectValues(portal_type=[line_portal_type,])\n
#context.log("will erease old line", old_line)\n #context.log("will erease old line", old_line)\n
if len(old_line)>0:\n if len(old_line)>0:\n
for object_list in old_line:\n for object_list in old_line:\n
...@@ -266,7 +266,7 @@ if variation_not_defined:\n ...@@ -266,7 +266,7 @@ if variation_not_defined:\n
else:\n else:\n
request = context.REQUEST\n request = context.REQUEST\n
redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n
, \'portal_status_message=Lines%%20Created\'\n , \'portal_status_message=Lines%20Created\'\n
)\n )\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n request[ \'RESPONSE\' ].redirect( redirect_url )\n
...@@ -349,14 +349,11 @@ else:\n ...@@ -349,14 +349,11 @@ else:\n
<string>column_base_list</string> <string>column_base_list</string>
<string>base_category_list</string> <string>base_category_list</string>
<string>per_resource_dict</string> <string>per_resource_dict</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>x</string>
<string>old_line</string> <string>old_line</string>
<string>len</string> <string>len</string>
<string>_getiter_</string>
<string>object_list</string> <string>object_list</string>
<string>line</string> <string>line</string>
<string>xrange</string> <string>xrange</string>
...@@ -389,6 +386,9 @@ else:\n ...@@ -389,6 +386,9 @@ else:\n
<string>mapped_value_list</string> <string>mapped_value_list</string>
<string>variation_item</string> <string>variation_item</string>
<string>cell</string> <string>cell</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>request</string> <string>request</string>
<string>redirect_url</string> <string>redirect_url</string>
</tuple> </tuple>
......
...@@ -67,11 +67,7 @@ ...@@ -67,11 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
<string>hidden</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -81,36 +77,12 @@ ...@@ -81,36 +77,12 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,9 +67,6 @@ ...@@ -67,9 +67,6 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
</list> </list>
</value> </value>
...@@ -80,30 +77,12 @@ ...@@ -80,30 +77,12 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,11 +67,7 @@ ...@@ -67,11 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
<string>hidden</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -81,36 +77,12 @@ ...@@ -81,36 +77,12 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>Default</string> <string>left</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>Default</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>my_start_number</string> <string>my_start_number</string>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>Default</string> <string>bottom</string>
<string>hidden</string> <string>hidden</string>
</list> </list>
</value> </value>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>Default</string> </key> <key> <string>bottom</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>Default</string> <string>left</string>
<string>right</string> <string>right</string>
<string>center</string> <string>center</string>
<string>bottom</string> <string>bottom</string>
...@@ -79,12 +79,6 @@ ...@@ -79,12 +79,6 @@
<key> <string>groups</string> </key> <key> <string>groups</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>Default</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value> <value>
...@@ -108,6 +102,12 @@ ...@@ -108,6 +102,12 @@
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
......
...@@ -130,8 +130,8 @@ if column_names == 1:\n ...@@ -130,8 +130,8 @@ if column_names == 1:\n
column_list.append((\'general_total_price\', \'General TotalPrice\'))\n column_list.append((\'general_total_price\', \'General TotalPrice\'))\n
return column_list\n return column_list\n
\n \n
context.log(\'node_category\',vault)\n #context.log(\'node_category\',vault)\n
context.log(\'inventory_kw\',inventory_kw)\n #context.log(\'inventory_kw\',inventory_kw)\n
vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node_category=vault\n vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node_category=vault\n
, ignore_variation=0\n , ignore_variation=0\n
,**inventory_kw\n ,**inventory_kw\n
...@@ -155,6 +155,9 @@ for vault_inventory in vault_inventory_list:\n ...@@ -155,6 +155,9 @@ for vault_inventory in vault_inventory_list:\n
total_price = vault_inventory.total_price\n total_price = vault_inventory.total_price\n
if total_price is None:\n if total_price is None:\n
total_price = 0\n total_price = 0\n
if only_positive:\n
total_price = abs(total_price)\n
total_quantity = abs(total_quantity)\n
# context.log(\'type\',type(total_price))\n # context.log(\'type\',type(total_price))\n
# context.log(\'sql total_price\',total_price)\n # context.log(\'sql total_price\',total_price)\n
vault_inventory_dict[vault_url][resource] = {\'quantity\':total_quantity, \'total_price\':total_price,\n vault_inventory_dict[vault_url][resource] = {\'quantity\':total_quantity, \'total_price\':total_price,\n
...@@ -257,7 +260,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -257,7 +260,7 @@ return repr([x for x in total_inventory_list])\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>vault=None,at_date=None,from_date=None,vault_report_type=None,column_names=0,resource_portal_type=(\'Banknote\',\'Coin\'),**kw</string> </value> <value> <string>vault=None,at_date=None,from_date=None,vault_report_type=None,column_names=0,resource_portal_type=(\'Banknote\',\'Coin\'), only_positive=0, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -277,7 +280,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -277,7 +280,7 @@ return repr([x for x in total_inventory_list])\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>6</int> </value> <value> <int>7</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -289,6 +292,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -289,6 +292,7 @@ return repr([x for x in total_inventory_list])\n
<string>vault_report_type</string> <string>vault_report_type</string>
<string>column_names</string> <string>column_names</string>
<string>resource_portal_type</string> <string>resource_portal_type</string>
<string>only_positive</string>
<string>kw</string> <string>kw</string>
<string>Products.ERP5Type.Document</string> <string>Products.ERP5Type.Document</string>
<string>newTempBase</string> <string>newTempBase</string>
...@@ -306,13 +310,14 @@ return repr([x for x in total_inventory_list])\n ...@@ -306,13 +310,14 @@ return repr([x for x in total_inventory_list])\n
<string>_getitem_</string> <string>_getitem_</string>
<string>column_list</string> <string>column_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>context</string>
<string>_apply_</string> <string>_apply_</string>
<string>context</string>
<string>vault_inventory_list</string> <string>vault_inventory_list</string>
<string>vault_inventory</string> <string>vault_inventory</string>
<string>resource</string> <string>resource</string>
<string>total_quantity</string> <string>total_quantity</string>
<string>total_price</string> <string>total_price</string>
<string>abs</string>
<string>total_inventory_list</string> <string>total_inventory_list</string>
<string>i</string> <string>i</string>
<string>variation_text</string> <string>variation_text</string>
...@@ -352,6 +357,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -352,6 +357,7 @@ return repr([x for x in total_inventory_list])\n
<string>Banknote</string> <string>Banknote</string>
<string>Coin</string> <string>Coin</string>
</tuple> </tuple>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -67,9 +67,6 @@ ...@@ -67,9 +67,6 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
<string>hidden</string> <string>hidden</string>
</list> </list>
...@@ -81,38 +78,20 @@ ...@@ -81,38 +78,20 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <value>
<list> <list>
<string>listbox_site</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>left</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox_site</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>Default</string> <string>left</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>Default</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>my_vault_report_type</string> <string>my_vault_report_type</string>
......
...@@ -67,9 +67,6 @@ ...@@ -67,9 +67,6 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
<string>hidden</string> <string>hidden</string>
</list> </list>
...@@ -82,37 +79,20 @@ ...@@ -82,37 +79,20 @@
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value> <value>
<list/> <list>
</value> <string>listbox</string>
</item> </list>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string>
<string>listbox_total_price</string> <string>listbox_total_price</string>
<string>listbox_total_quantity</string> <string>listbox_total_quantity</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>Default</string> <string>bottom</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>Default</string> </key> <key> <string>bottom</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
......
...@@ -75,8 +75,10 @@ commission_price = context.getDiscount()\n ...@@ -75,8 +75,10 @@ commission_price = context.getDiscount()\n
if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n
return None\n return None\n
if commission_ratio == 0 or commission_price == 0:\n if commission_ratio == 0 or commission_price == 0:\n
price = round(price,0)\n
return price\n return price\n
if commission_ratio is None and commission_price is None:\n if commission_ratio is None and commission_price is None:\n
price = round(price,0)\n
return price\n return price\n
\n \n
if commission_ratio is not None:\n if commission_ratio is not None:\n
...@@ -86,7 +88,7 @@ if commission_price is not None:\n ...@@ -86,7 +88,7 @@ if commission_price is not None:\n
commission_value = commission_price\n commission_value = commission_price\n
\n \n
quantity = price - commission_value\n quantity = price - commission_value\n
quantity = round(quantity-0.5,0)\n quantity = round(quantity,0)\n
if quantity!=context.getQuantity():\n if quantity!=context.getQuantity():\n
context.setQuantity(quantity)\n context.setQuantity(quantity)\n
return quantity\n return quantity\n
...@@ -148,9 +150,9 @@ return quantity\n ...@@ -148,9 +150,9 @@ return quantity\n
<string>commission_ratio</string> <string>commission_ratio</string>
<string>commission_price</string> <string>commission_price</string>
<string>None</string> <string>None</string>
<string>round</string>
<string>commission_value</string> <string>commission_value</string>
<string>quantity</string> <string>quantity</string>
<string>round</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -75,8 +75,10 @@ commission_price = context.getDiscount()\n ...@@ -75,8 +75,10 @@ commission_price = context.getDiscount()\n
if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n
return None\n return None\n
if commission_ratio == 0 or commission_price == 0:\n if commission_ratio == 0 or commission_price == 0:\n
price = round(price,0)\n
return price\n return price\n
if commission_ratio is None and commission_price is None:\n if commission_ratio is None and commission_price is None:\n
price = round(price,0)\n
return price\n return price\n
\n \n
if commission_ratio is not None:\n if commission_ratio is not None:\n
...@@ -86,7 +88,7 @@ if commission_price is not None:\n ...@@ -86,7 +88,7 @@ if commission_price is not None:\n
commission_value = commission_price\n commission_value = commission_price\n
\n \n
quantity = price + commission_value\n quantity = price + commission_value\n
quantity = round(quantity+0.5,0)\n quantity = round(quantity,0)\n
if quantity!=context.getQuantity():\n if quantity!=context.getQuantity():\n
context.setQuantity(quantity)\n context.setQuantity(quantity)\n
return quantity\n return quantity\n
...@@ -148,9 +150,9 @@ return quantity\n ...@@ -148,9 +150,9 @@ return quantity\n
<string>commission_ratio</string> <string>commission_ratio</string>
<string>commission_price</string> <string>commission_price</string>
<string>None</string> <string>None</string>
<string>round</string>
<string>commission_value</string> <string>commission_value</string>
<string>quantity</string> <string>quantity</string>
<string>round</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -82,7 +82,7 @@ if None in (rate, price):\n ...@@ -82,7 +82,7 @@ if None in (rate, price):\n
\n \n
price = float(price)\n price = float(price)\n
\n \n
return rate * price\n return round(rate * price)\n
]]></string> </value> ]]></string> </value>
...@@ -140,6 +140,7 @@ return rate * price\n ...@@ -140,6 +140,7 @@ return rate * price\n
<string>_getitem_</string> <string>_getitem_</string>
<string>price</string> <string>price</string>
<string>float</string> <string>float</string>
<string>round</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -67,9 +67,6 @@ ...@@ -67,9 +67,6 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
</list> </list>
</value> </value>
...@@ -80,30 +77,12 @@ ...@@ -80,30 +77,12 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,9 +67,6 @@ ...@@ -67,9 +67,6 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
</list> </list>
</value> </value>
...@@ -80,30 +77,12 @@ ...@@ -80,30 +77,12 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -67,9 +67,6 @@ ...@@ -67,9 +67,6 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string> <string>bottom</string>
</list> </list>
</value> </value>
...@@ -80,30 +77,12 @@ ...@@ -80,30 +77,12 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
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