Commit 6ff99816 authored by Sebastien Robin's avatar Sebastien Robin

we now take into account stock changes with cash sorting incident

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12833 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8fc8a481
<?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[
# We will create a new account transfer and then copy most of local properties\n
# to the new account transfer created\n
request=context.REQUEST\n
portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
edit_kw = {}\n
edit_kw[\'delivery_mode\'] = context.getDeliveryMode()\n
edit_kw[\'source_section\'] = context.getSourceSection()\n
edit_kw[\'source_payment\'] = context.getSourcePayment()\n
edit_kw[\'external_software\'] = context.getExternalSoftware()\n
edit_kw[\'posted\'] = context.getPosted()\n
edit_kw[\'description\'] = context.getDescription()\n
\n
new_transfer = context.account_transfer_module.newContent(**edit_kw)\n
\n
message = N_("Account Transfer duplicated.")\n
if not selection_index:\n
redirect_url = \'%s/%s?portal_status_message=%s\' % (new_transfer.absolute_url(),\n
form_id,\n
message)\n
else:\n
redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&portal_status_message=%s\' % (\n
new_transfer.absolute_url(),\n
form_id,\n
selection_index,\n
selection_name,\n
message)\n
\n
return request[\'RESPONSE\'].redirect(redirect_url)\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id, selection_index=0, selection_name=\'\', dialog_id=\'\', ignore_layout=None,**kw</string> </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>5</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>form_id</string>
<string>selection_index</string>
<string>selection_name</string>
<string>dialog_id</string>
<string>ignore_layout</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
<string>portal</string>
<string>N_</string>
<string>edit_kw</string>
<string>_write_</string>
<string>_apply_</string>
<string>new_transfer</string>
<string>message</string>
<string>redirect_url</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
<string></string>
<string></string>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountTransfer_duplicate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
user_site_list = context.Baobab_getUserAssignedSiteList()\n
if len(user_site_list)>0:\n
site = context.Baobab_getVaultSite(user_site_list[0])\n
site_url = site.getRelativeUrl()\n
context.setSite(site_url)\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>user_site_list</string>
<string>len</string>
<string>_getitem_</string>
<string>site</string>
<string>site_url</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountTransfer_init</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>return "%s/surface/salle_tri/encaisse_des_differences" %(context.getSource(),)\n <value> <string>return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSource(),)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>return "%s/surface/salle_tri/encaisse_des_differences" %(context.getSource(),)\n <value> <string>return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSource(),)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSource(),)\n <value> <string>return None\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -119,8 +119,7 @@ ...@@ -119,8 +119,7 @@
<tuple> <tuple>
<string>args</string> <string>args</string>
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>None</string>
<string>context</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -79,7 +79,7 @@ out_list = txn.objectValues(portal_type=\'Outgoing Cash Sorting Incident Line\') ...@@ -79,7 +79,7 @@ out_list = txn.objectValues(portal_type=\'Outgoing Cash Sorting Incident Line\')
price = txn.getSourceTotalAssetPrice()\n price = txn.getSourceTotalAssetPrice()\n
in_price = txn.getTotalPrice(portal_type=[\'Incoming Cash Sorting Incident Line\',\'Cash Delivery Cell\'],fast=0)\n in_price = txn.getTotalPrice(portal_type=[\'Incoming Cash Sorting Incident Line\',\'Cash Delivery Cell\'],fast=0)\n
out_price = txn.getTotalPrice(portal_type=[\'Outgoing Cash Sorting Incident Line\',\'Cash Delivery Cell\'],fast=0)\n out_price = txn.getTotalPrice(portal_type=[\'Outgoing Cash Sorting Incident Line\',\'Cash Delivery Cell\'],fast=0)\n
\n vault = "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(txn.getSource(),)\n
\n \n
if len(in_list) != 0 and len(out_list) != 0:\n if len(in_list) != 0 and len(out_list) != 0:\n
msg = Message(domain = "ui", message="You can\'t have excess and deficit on the document.")\n msg = Message(domain = "ui", message="You can\'t have excess and deficit on the document.")\n
...@@ -87,10 +87,16 @@ if len(in_list) != 0 and len(out_list) != 0:\n ...@@ -87,10 +87,16 @@ if len(in_list) != 0 and len(out_list) != 0:\n
elif len(in_list) == 0 and len(out_list) == 0:\n elif len(in_list) == 0 and len(out_list) == 0:\n
msg = Message(domain = "ui", message="No resource.")\n msg = Message(domain = "ui", message="No resource.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n
elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != price):\n elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != price):\n
msg = Message(domain = "ui", message="Price differs between document and resource.")\n msg = Message(domain = "ui", message="Price differs between document and resource.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n
if len(out_list) !=0:\n
\n
resource = txn.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Cash Sorting Incident Line\')\n
if resource != 0 :\n
msg = Message(domain="ui", message="Insufficient Balance.")\n
raise ValidationFailed, (msg,)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -146,8 +152,10 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p ...@@ -146,8 +152,10 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
<string>price</string> <string>price</string>
<string>in_price</string> <string>in_price</string>
<string>out_price</string> <string>out_price</string>
<string>vault</string>
<string>len</string> <string>len</string>
<string>msg</string> <string>msg</string>
<string>resource</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?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>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
transaction = state_change[\'object\']\n
# Compute the source form the vault choosen by\n
# the accountant and find the counter with the\n
# user logged in\n
user_id = transaction.portal_membership.getAuthenticatedMember().getUserName()\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
# context.log(\'validateVaultBalance site_list\',site_list)\n
source = transaction.getSource()\n
baobab_source = None\n
for site in site_list:\n
site_value = context.portal_categories.getCategoryValue(site)\n
if site_value.getVaultType().endswith(\'guichet\') and source in site:\n
baobab_source = site + \'/encaisse_des_billets_et_monnaies/sortante\'\n
break\n
source = baobab_source\n
source_object = context.portal_categories.getCategoryValue(source)\n
\n
# check again that we are in the good accounting date\n
if not transaction.Baobab_checkCounterDateOpen(site=source_object, date=transaction.getStartDate()):\n
msg = Message(domain = "ui", message="Transaction not in the good accounting date")\n
raise ValidationFailed, (msg,)\n
\n
resource = transaction.CashDelivery_checkCounterInventory(source = source, portal_type=\'Cash Delivery Line\', same_source=1)\n
#transaction.log("call to CashDelivery_getCounterInventory return", resource)\n
\n
# Get price and total_price.\n
price = transaction.getSourceTotalAssetPrice()\n
cash_detail = transaction.getTotalPrice(portal_type = (\'Cash Delivery Line\',\'Cash Delivery Cell\'), fast=0)\n
#transaction.log("price vs cash detail", str((price, cash_detail)))\n
if resource == 3:\n
msg = Message(domain="ui", message="No banknote or coin defined.")\n
raise ValidationFailed, (msg,)\n
elif resource == 2:\n
msg = Message(domain="ui", message="No resource defined.")\n
raise ValidationFailed, (msg,)\n
elif price != cash_detail:\n
msg = Message(domain="ui", message="Amount differs from input.")\n
raise ValidationFailed, (msg,)\n
elif resource == 1:\n
msg = Message(domain="ui", message="Insufficient Balance in counter.")\n
raise ValidationFailed, (msg,)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>_getitem_</string>
<string>transaction</string>
<string>_getattr_</string>
<string>user_id</string>
<string>context</string>
<string>site_list</string>
<string>source</string>
<string>None</string>
<string>baobab_source</string>
<string>_getiter_</string>
<string>site</string>
<string>site_value</string>
<string>source_object</string>
<string>msg</string>
<string>resource</string>
<string>price</string>
<string>cash_detail</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>validateVaultBalance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -108,11 +108,7 @@ elif len(in_list) == 0 and len(out_list) == 0:\n ...@@ -108,11 +108,7 @@ elif len(in_list) == 0 and len(out_list) == 0:\n
msg = Message(domain = "ui", message="No resource.")\n msg = Message(domain = "ui", message="No resource.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
elif len(out_list) !=0:\n \n
resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Usual Cash Incident Line\')\n
if resource <> 0 :\n
msg = Message(domain="ui", message="Insufficient Balance.")\n
raise ValidationFailed, (msg,)\n
\n \n
elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != price):\n elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != price):\n
msg = Message(domain = "ui", message="Price differs between document and resource.")\n msg = Message(domain = "ui", message="Price differs between document and resource.")\n
...@@ -183,7 +179,6 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p ...@@ -183,7 +179,6 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
<string>in_price</string> <string>in_price</string>
<string>out_price</string> <string>out_price</string>
<string>len</string> <string>len</string>
<string>resource</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
172 174
\ No newline at end of file \ 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