Commit 482ff80d authored by Aurel's avatar Aurel

add validator on accounting cancellation line

refuse negative value in fast input
source reference must be compute with document site before user site
and many other fix

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17890 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 02b43105
...@@ -36,7 +36,20 @@ ...@@ -36,7 +36,20 @@
<item> <item>
<key> <string>_property_domain_dict</string> </key> <key> <string>_property_domain_dict</string> </key>
<value> <value>
<dictionary/> <dictionary>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value> </value>
</item> </item>
<item> <item>
...@@ -105,4 +118,44 @@ be a problem).</string> </value> ...@@ -105,4 +118,44 @@ be a problem).</string> </value>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_content</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_content</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</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[
if editor in (None, \'\') : \n
return 1\n
\n
if int(editor) > 0:\n
return 0\n
\n
return 1\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>editor, request</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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>editor</string>
<string>request</string>
<string>None</string>
<string>int</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>AccountingCancellationLine_validateInputAmount</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>You must input a negative value.</string> </value>
</item> </item>
<item> <item>
<key> <string>not_float</string> </key> <key> <string>not_float</string> </key>
...@@ -216,7 +216,9 @@ ...@@ -216,7 +216,9 @@
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
...@@ -284,4 +286,20 @@ ...@@ -284,4 +286,20 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>AccountingCancellationLine_validateInputAmount</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>You must input a negative value.</string> </value>
</item> </item>
<item> <item>
<key> <string>not_float</string> </key> <key> <string>not_float</string> </key>
...@@ -216,7 +216,9 @@ ...@@ -216,7 +216,9 @@
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
...@@ -284,4 +286,20 @@ ...@@ -284,4 +286,20 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>AccountingCancellationLine_validateInputAmount</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -357,11 +357,11 @@ ...@@ -357,11 +357,11 @@
</tuple> </tuple>
<tuple> <tuple>
<string>source_debit</string> <string>source_debit</string>
<string>Debit</string> <string>Credit</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_credit</string> <string>source_credit</string>
<string>Credit</string> <string>Debit</string>
</tuple> </tuple>
<tuple> <tuple>
<string>getDestinationPaymentInternalBankAccountNumber</string> <string>getDestinationPaymentInternalBankAccountNumber</string>
......
...@@ -67,23 +67,22 @@ ...@@ -67,23 +67,22 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
return\n
\n \n
if simulation_state_list is None:\n if simulation_state_list is None:\n
simulation_state_list = [\'open\']\n simulation_state_list = [\'open\']\n
\n \n
site = context.Baobab_getVaultSite(counter)\n site = context.Baobab_getVaultSite(counter)\n
counter_list = [x.getObject() for x in context.portal_catalog(portal_type="Counter", \n counter_list = [x.getObject() for x in context.portal_catalog(portal_type="Counter", \n
simulation_state = simulation_state_list, site_uid = site.getUid())]\n simulation_state = simulation_state_list, default_site_uid = site.getUid())]\n
if same_type(counter, \'a\'):\n if same_type(counter, \'a\'):\n
counter_relative_url = counter\n counter_relative_url = counter\n
else:\n else:\n
counter_relative_url = counter.getRelativeUrl()\n counter_relative_url = counter.getRelativeUrl()\n
found = 0\n found = 0\n
if "guichet" in counter_relative_url:\n #if "guichet" in counter_relative_url:\n
for counter_ob in counter_list:\n for counter_ob in counter_list:\n
if "site/%s" %counter_ob.getSite() in counter_relative_url or counter_relative_url in "site/%s" %counter_ob.getSite():\n if "site/%s" %counter_ob.getSite() in counter_relative_url or counter_relative_url in "site/%s" %counter_ob.getSite():\n
found = 1\n found = 1\n
if found == 0:\n if found == 0:\n
msg = Message(domain = "ui", message="Counter is not opened")\n msg = Message(domain = "ui", message="Counter is not opened")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
......
...@@ -72,7 +72,10 @@ for a in site_list:\n ...@@ -72,7 +72,10 @@ for a in site_list:\n
a = \'site/\' + a\n a = \'site/\' + a\n
site_codification = context.portal_categories.getCategoryValue(a).getCodification()\n site_codification = context.portal_categories.getCategoryValue(a).getCodification()\n
if site_codification not in (\'\', None):\n if site_codification not in (\'\', None):\n
emission_letter_dict[site_codification[0].lower()] = 1\n lower_letter = site_codification[0].lower()\n
if lower_letter == \'z\':\n
lower_letter = \'k\'\n
emission_letter_dict[lower_letter] = 1\n
\n \n
return emission_letter_dict.keys()\n return emission_letter_dict.keys()\n
</string> </value> </string> </value>
...@@ -131,8 +134,9 @@ return emission_letter_dict.keys()\n ...@@ -131,8 +134,9 @@ return emission_letter_dict.keys()\n
<string>context</string> <string>context</string>
<string>site_codification</string> <string>site_codification</string>
<string>None</string> <string>None</string>
<string>_write_</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>lower_letter</string>
<string>_write_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -71,7 +71,10 @@ from Products.ERP5Type.Cache import CachingMethod\n ...@@ -71,7 +71,10 @@ from Products.ERP5Type.Cache import CachingMethod\n
def getSiteEmissionLetter(site=None):\n def getSiteEmissionLetter(site=None):\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
site_object = portal.portal_categories.restrictedTraverse(site)\n site_object = portal.portal_categories.restrictedTraverse(site)\n
return site_object.getCodification()[0].lower()\n lower_letter = site_object.getCodification()[0].lower()\n
if lower_letter == \'z\':\n
lower_letter = \'k\'\n
return lower_letter\n
\n \n
getSiteEmissionLetter = CachingMethod(getSiteEmissionLetter,\n getSiteEmissionLetter = CachingMethod(getSiteEmissionLetter,\n
id = \'Baobab_getSiteEmissionLetter\',\n id = \'Baobab_getSiteEmissionLetter\',\n
......
...@@ -90,16 +90,23 @@ if reference in (None, \'\') or not str(reference).startswith(application_id):\n ...@@ -90,16 +90,23 @@ if reference in (None, \'\') or not str(reference).startswith(application_id):\n
if codification in (None, \'\'):\n if codification in (None, \'\'):\n
return \'\'\n return \'\'\n
else:\n else:\n
# get source from user site\n # get from document site\n
site_list = context.Baobab_getUserAssignedSiteList()\n site = context.getSiteValue()\n
if len(site_list) == 0:\n if site not in (None, \'\'):\n
return \'\'\n codification = site.getCodification()\n
else:\n
site = site_list[0]\n
site_value = context.restrictedTraverse(\'portal_categories/%s\' %(site,))\n
codification = site_value.getCodification()\n
if codification in (None, \'\'):\n if codification in (None, \'\'):\n
return \'\'\n return \'\'\n
else:\n
# get source from user site\n
site_list = context.Baobab_getUserAssignedSiteList()\n
if len(site_list) == 0:\n
return \'\'\n
else:\n
site = site_list[0]\n
site_value = context.restrictedTraverse(\'portal_categories/%s\' %(site,))\n
codification = site_value.getCodification()\n
if codification in (None, \'\'):\n
return \'\'\n
\n \n
# actual generation\n # actual generation\n
#if reference in (None, \'\'): \n #if reference in (None, \'\'): \n
...@@ -176,10 +183,10 @@ return reference\n ...@@ -176,10 +183,10 @@ return reference\n
<string>year</string> <string>year</string>
<string>source</string> <string>source</string>
<string>codification</string> <string>codification</string>
<string>site</string>
<string>site_list</string> <string>site_list</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>site</string>
<string>site_value</string> <string>site_value</string>
<string>baobab_id_group</string> <string>baobab_id_group</string>
<string>new_id</string> <string>new_id</string>
......
...@@ -109,6 +109,8 @@ if movement is not None: # case of history\n ...@@ -109,6 +109,8 @@ if movement is not None: # case of history\n
resource_dict[\'explanation_relative_url\'] = explanation_value.getRelativeUrl()\n resource_dict[\'explanation_relative_url\'] = explanation_value.getRelativeUrl()\n
source_reference = explanation_value.getSourceReference() or \'\'\n source_reference = explanation_value.getSourceReference() or \'\'\n
resource_dict[\'source_reference\'] = source_reference\n resource_dict[\'source_reference\'] = source_reference\n
if display_simulation_state:\n
resource_dict[\'simulation_state_title\'] = movement.getTranslatedSimulationStateTitle()\n
resource_dict[\'explanation_translated_relative_url\'] = "%s/%s" % \\\n resource_dict[\'explanation_translated_relative_url\'] = "%s/%s" % \\\n
(explanation_value.getTranslatedPortalType(),source_reference)\n (explanation_value.getTranslatedPortalType(),source_reference)\n
resource_dict[\'base_price\'] = resource_value.getBasePrice()\n resource_dict[\'base_price\'] = resource_value.getBasePrice()\n
...@@ -149,7 +151,7 @@ return resource_dict\n ...@@ -149,7 +151,7 @@ return resource_dict\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>resource, variation_text, movement=None</string> </value> <value> <string>resource, variation_text, movement=None, display_simulation_state=0</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
...@@ -177,7 +179,7 @@ return resource_dict\n ...@@ -177,7 +179,7 @@ return resource_dict\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -186,6 +188,7 @@ return resource_dict\n ...@@ -186,6 +188,7 @@ return resource_dict\n
<string>resource</string> <string>resource</string>
<string>variation_text</string> <string>variation_text</string>
<string>movement</string> <string>movement</string>
<string>display_simulation_state</string>
<string>resource_dict</string> <string>resource_dict</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
...@@ -216,6 +219,7 @@ return resource_dict\n ...@@ -216,6 +219,7 @@ return resource_dict\n
<value> <value>
<tuple> <tuple>
<none/> <none/>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -123,7 +123,7 @@ def checkActivities(source_counter):\n ...@@ -123,7 +123,7 @@ def checkActivities(source_counter):\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
inventory_list = context.portal_simulation.getCurrentInventoryList(\n inventory_list = context.portal_simulation.getCurrentInventoryList(\n
at_date=start_date,\n #at_date=start_date,\n
group_by_variation=1,\n group_by_variation=1,\n
group_by_node=1,\n group_by_node=1,\n
group_by_resource=1,\n group_by_resource=1,\n
......
...@@ -91,6 +91,9 @@ else:\n ...@@ -91,6 +91,9 @@ else:\n
base_category_list = (\'emission_letter\', \'cash_status\', \'variation\')\n base_category_list = (\'emission_letter\', \'cash_status\', \'variation\')\n
per_resource_dict = {}\n per_resource_dict = {}\n
\n \n
error = 0\n
negative_quantity = 0\n
float_quantity = 0\n
# remove previous line\n # remove previous line\n
# specific case for monetary issue\n # specific case for monetary issue\n
if context.getPortalType() == "Monetary Issue":\n if context.getPortalType() == "Monetary Issue":\n
...@@ -109,6 +112,12 @@ for line in listbox:\n ...@@ -109,6 +112,12 @@ for line in listbox:\n
for counter in xrange(1, len(column_base_list)+1):\n for counter in xrange(1, len(column_base_list)+1):\n
quantity = line["column%s" %(str(counter),)]\n quantity = line["column%s" %(str(counter),)]\n
if quantity != 0 and quantity != \'\':\n if quantity != 0 and quantity != \'\':\n
if quantity < 0:\n
error = 1\n
negative_quantity = 1\n
if int("%i" % quantity) != quantity:\n
error = 1\n
float_quantity = 1\n
#context.log("listboxline", line)\n #context.log("listboxline", line)\n
movement = {}\n movement = {}\n
movement[\'quantity\'] = quantity\n movement[\'quantity\'] = quantity\n
...@@ -173,7 +182,7 @@ for line in listbox:\n ...@@ -173,7 +182,7 @@ for line in listbox:\n
# create the movement\n # create the movement\n
variation_not_defined = 0\n variation_not_defined = 0\n
for resource_id in per_resource_dict.keys():\n for resource_id in per_resource_dict.keys():\n
if variation_not_defined == 1:\n if error == 1:\n
break\n break\n
variation_list_dict = per_resource_dict[resource_id].values()\n variation_list_dict = per_resource_dict[resource_id].values()\n
# get the resource\n # get the resource\n
...@@ -197,6 +206,7 @@ for resource_id in per_resource_dict.keys():\n ...@@ -197,6 +206,7 @@ for resource_id in per_resource_dict.keys():\n
# break\n # break\n
if variation.replace(\'variation/\',\'\') not in resource_object.getVariationList():\n if variation.replace(\'variation/\',\'\') not in resource_object.getVariationList():\n
variation_not_defined = 1\n variation_not_defined = 1\n
error = 1\n
break\n break\n
# for the letter, if coin, must always be not_defined\n # for the letter, if coin, must always be not_defined\n
if letter != \'emission_letter/not_defined\' and letter.replace(\'emission_letter/\',\'\') not in resource_object.getEmissionLetterList()+[\'mixed\']:\n if letter != \'emission_letter/not_defined\' and letter.replace(\'emission_letter/\',\'\') not in resource_object.getEmissionLetterList()+[\'mixed\']:\n
...@@ -285,12 +295,17 @@ for resource_id in per_resource_dict.keys():\n ...@@ -285,12 +295,17 @@ for resource_id in per_resource_dict.keys():\n
request = context.REQUEST\n request = context.REQUEST\n
N_ = context.Base_translateString\n N_ = context.Base_translateString\n
\n \n
if variation_not_defined:\n if error:\n
old_line = [x.getObject() for x in context.objectValues(portal_type=[line_portal_type,])]\n old_line = [x.getObject() for x in context.objectValues(portal_type=[line_portal_type,])]\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
context.deleteContent(object_list.getId())\n context.deleteContent(object_list.getId())\n
message = N_("$title doesn\'t exist for $variation", mapping = {\'title\':resource_object.getTranslatedTitle(), \'variation\':variation.replace(\'variation/\',\'\')})\n if variation_not_defined:\n
message = N_("$title doesn\'t exist for $variation", mapping = {\'title\':resource_object.getTranslatedTitle(), \'variation\':variation.replace(\'variation/\',\'\')})\n
if negative_quantity:\n
message = N_("You must not enter negative values")\n
if float_quantity:\n
message = N_("You must not enter int values")\n
redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n
, "portal_status_message=%s" %message\n , "portal_status_message=%s" %message\n
)\n )\n
...@@ -378,6 +393,9 @@ else:\n ...@@ -378,6 +393,9 @@ 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>error</string>
<string>negative_quantity</string>
<string>float_quantity</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>append</string> <string>append</string>
...@@ -393,6 +411,7 @@ else:\n ...@@ -393,6 +411,7 @@ else:\n
<string>counter</string> <string>counter</string>
<string>str</string> <string>str</string>
<string>quantity</string> <string>quantity</string>
<string>int</string>
<string>movement</string> <string>movement</string>
<string>_write_</string> <string>_write_</string>
<string>movement_key</string> <string>movement_key</string>
......
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
site_uid = site.getUid()\n site_uid = site.getUid()\n
site_url = site.getRelativeUrl()\n site_url = site.getRelativeUrl()\n
operation_list = []\n operation_list = []\n
exception_portal_type_list = [\'Paper Money Deposit\', \'Foreign Check\', \'External Banking Operation\', \'Account Transfer\', \'Check Deposit\']\n exception_portal_type_list = [\'Paper Money Deposit\', \'Foreign Check\', \'External Banking Operation\', \'Account Transfer\', \'Check Deposit\',\n
\'Checkbook Reception\', \'Accounting Cancellation\']\n
if site_uid is not None:\n if site_uid is not None:\n
not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\', \'ready\', \'deposited\', \'received\')\n not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\', \'ready\', \'deposited\', \'received\')\n
portal_type_list = [x for x in context.getPortalDeliveryTypeList()\n portal_type_list = [x for x in context.getPortalDeliveryTypeList()\n
...@@ -88,9 +89,10 @@ if site_uid is not None:\n ...@@ -88,9 +89,10 @@ if site_uid is not None:\n
simulation_state = document.getSimulationState()\n simulation_state = document.getSimulationState()\n
if (portal_type in (\'Stop Payment\', ) and simulation_state == \'started\') \\\n if (portal_type in (\'Stop Payment\', ) and simulation_state == \'started\') \\\n
or (portal_type == \'Mutilated Banknote\' and \n or (portal_type == \'Mutilated Banknote\' and \n
(simulation_state == \'planned\' or \n simulation_state == \'finished\' \\\n
(simulation_state == \'finished\' and \'siege\' in here.getSource(\'\'))\n ) \\\n
)\n or (portal_type == \'Check Payment\' and \n
simulation_state in (\'planned\', \'ordered\') \\\n
) \\\n ) \\\n
or (portal_type == \'Monetary Destruction\' and simulation_state == \'ordered\'):\n or (portal_type == \'Monetary Destruction\' and simulation_state == \'ordered\'):\n
continue\n continue\n
...@@ -185,7 +187,6 @@ return operation_list\n ...@@ -185,7 +187,6 @@ return operation_list\n
<string>document</string> <string>document</string>
<string>portal_type</string> <string>portal_type</string>
<string>simulation_state</string> <string>simulation_state</string>
<string>here</string>
<string>operation_sort</string> <string>operation_sort</string>
</tuple> </tuple>
</value> </value>
......
...@@ -82,6 +82,9 @@ if from_date is not None:\n ...@@ -82,6 +82,9 @@ if from_date is not None:\n
if from_date == at_date:\n if from_date == at_date:\n
from_date=None\n from_date=None\n
\n \n
if only_last_date and vault_report_type==\'history\':\n
from_date = at_date\n
\n
#context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n #context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n
def getTranslatedTitleFromCategoryUrl(category):\n def getTranslatedTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n return context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n
...@@ -104,7 +107,9 @@ portal = context.getPortalObject()\n ...@@ -104,7 +107,9 @@ portal = context.getPortalObject()\n
vault_url_list = vault\n vault_url_list = vault\n
if same_type(vault, \'a\'):\n if same_type(vault, \'a\'):\n
vault_url_list = [vault,]\n vault_url_list = [vault,]\n
\n #context.log("vault_url_list", vault_url_list)\n
if vault_url_list is None:\n
raise ValueError, "The vault must be defined"\n
for vault_url in vault_url_list:\n for vault_url in vault_url_list:\n
vault_dict[vault_url] = 1\n vault_dict[vault_url] = 1\n
vault_inventory_dict[vault_url] = {}\n vault_inventory_dict[vault_url] = {}\n
...@@ -130,6 +135,8 @@ def cartesianProduct(list_of_list):\n ...@@ -130,6 +135,8 @@ def cartesianProduct(list_of_list):\n
total_inventory_list = []\n total_inventory_list = []\n
inventory_kw = {}\n inventory_kw = {}\n
#context.log(\'CounterModule_getVaultTransactionList, vault_report_type\',vault_report_type)\n #context.log(\'CounterModule_getVaultTransactionList, vault_report_type\',vault_report_type)\n
if vault_report_type == \'inventory\' and from_date is not None:\n
raise ValueError, "The from date must be None in the case of inventory"\n
if vault_report_type is None or vault_report_type==\'inventory\':\n if vault_report_type is None or vault_report_type==\'inventory\':\n
inventory_kw[\'group_by_variation\'] = 1\n inventory_kw[\'group_by_variation\'] = 1\n
inventory_kw[\'group_by_resource\'] = 1\n inventory_kw[\'group_by_resource\'] = 1\n
...@@ -194,14 +201,22 @@ if column_names == 1:\n ...@@ -194,14 +201,22 @@ if column_names == 1:\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=vault_url_list\n display_simulation_state = 0\n
if all_state and vault_report_type==\'history\':\n
display_simulation_state = 1\n
vault_inventory_list = context.portal_simulation.getInventoryList( node=vault_url_list\n
, ignore_variation=0\n
,**inventory_kw\n
)\n
else: \n
vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node=vault_url_list\n
, ignore_variation=0\n , ignore_variation=0\n
,**inventory_kw\n ,**inventory_kw\n
)\n )\n
#context.log(\'CounterMOdule_getVaultTransactionList, sql src:\',context.portal_simulation.getCurrentInventoryList( node=vault_url_list\n #context.log(\'CounterMOdule_getVaultTransactionList, sql src:\',context.portal_simulation.getCurrentInventoryList( node=vault_url_list\n
# , ignore_variation=0,src__=1\n #, ignore_variation=0,src__=1\n
# ,**inventory_kw\n #,**inventory_kw\n
# ))\n #))\n
\n \n
if summarise:\n if summarise:\n
total_quantity = 0\n total_quantity = 0\n
...@@ -272,7 +287,8 @@ for resource in resource_dict.keys():\n ...@@ -272,7 +287,8 @@ for resource in resource_dict.keys():\n
continue\n continue\n
variation_text = resource[1]\n variation_text = resource[1]\n
tmp_dict = context.Base_getResourceInformationDictFromUrlAndVariation(\n tmp_dict = context.Base_getResourceInformationDictFromUrlAndVariation(\n
resource_url, variation_text, movement=movement)\n resource_url, variation_text, movement=movement, \n
display_simulation_state= display_simulation_state)\n
general_total_price = 0\n general_total_price = 0\n
for vault in vault_dict.keys():\n for vault in vault_dict.keys():\n
try:\n try:\n
...@@ -331,7 +347,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -331,7 +347,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\'), only_positive=0, banknote_quantity_divisor=None, summarise=False, excluded_variation_list=None,**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, banknote_quantity_divisor=None, summarise=False, excluded_variation_list=None, all_state=0, only_last_date=0, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
...@@ -359,7 +375,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -359,7 +375,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>10</int> </value> <value> <int>12</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -375,6 +391,8 @@ return repr([x for x in total_inventory_list])\n ...@@ -375,6 +391,8 @@ return repr([x for x in total_inventory_list])\n
<string>banknote_quantity_divisor</string> <string>banknote_quantity_divisor</string>
<string>summarise</string> <string>summarise</string>
<string>excluded_variation_list</string> <string>excluded_variation_list</string>
<string>all_state</string>
<string>only_last_date</string>
<string>kw</string> <string>kw</string>
<string>Products.ERP5Type.Document</string> <string>Products.ERP5Type.Document</string>
<string>newTempBase</string> <string>newTempBase</string>
...@@ -390,6 +408,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -390,6 +408,7 @@ return repr([x for x in total_inventory_list])\n
<string>portal</string> <string>portal</string>
<string>vault_url_list</string> <string>vault_url_list</string>
<string>same_type</string> <string>same_type</string>
<string>ValueError</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>vault_url</string> <string>vault_url</string>
<string>_write_</string> <string>_write_</string>
...@@ -413,6 +432,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -413,6 +432,7 @@ return repr([x for x in total_inventory_list])\n
<string>variation</string> <string>variation</string>
<string>variation_text</string> <string>variation_text</string>
<string>column_list</string> <string>column_list</string>
<string>display_simulation_state</string>
<string>_apply_</string> <string>_apply_</string>
<string>vault_inventory_list</string> <string>vault_inventory_list</string>
<string>total_quantity</string> <string>total_quantity</string>
...@@ -461,6 +481,8 @@ return repr([x for x in total_inventory_list])\n ...@@ -461,6 +481,8 @@ return repr([x for x in total_inventory_list])\n
<none/> <none/>
<int>0</int> <int>0</int>
<none/> <none/>
<int>0</int>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -86,7 +86,10 @@ ...@@ -86,7 +86,10 @@
<string>my_vault</string> <string>my_vault</string>
<string>my_vault_report_type</string> <string>my_vault_report_type</string>
<string>my_from_date</string> <string>my_from_date</string>
<string>my_to_date</string> <string>my_at_date</string>
<string>my_all_state</string>
<string>my_only_last_date</string>
<string>my_reset</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_all_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>All States</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_to_date</string> </value> <value> <string>my_at_date</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_only_last_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Only last date</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -362,6 +362,10 @@ ...@@ -362,6 +362,10 @@
<string>explanation_translated_relative_url</string> <string>explanation_translated_relative_url</string>
<string>Explanation</string> <string>Explanation</string>
</tuple> </tuple>
<tuple>
<string>simulation_state_title</string>
<string>State</string>
</tuple>
<tuple> <tuple>
<string>total_quantity</string> <string>total_quantity</string>
<string>Quantity</string> <string>Quantity</string>
...@@ -570,7 +574,7 @@ ...@@ -570,7 +574,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <unicode>CounterModule_getVaultInventoryList</unicode> </value> <value> <string>CounterModule_getVaultInventoryList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -65,7 +65,10 @@ ...@@ -65,7 +65,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># return context.getMovementList(portal_type=portal_type)\n <value> <string>if portal_type is None:\n
portal_type = []\n
\n
# return context.getMovementList(portal_type=portal_type)\n
# here we suppose we have only two level of portal type\n # here we suppose we have only two level of portal type\n
#context.log("Delivery_getMovementList", "portal_type = %s" %(portal_type,))\n #context.log("Delivery_getMovementList", "portal_type = %s" %(portal_type,))\n
#context.log("Delivery_getMovementList", "len portal_type = %s" % (len(portal_type),))\n #context.log("Delivery_getMovementList", "len portal_type = %s" % (len(portal_type),))\n
...@@ -120,7 +123,7 @@ return cell_list\n ...@@ -120,7 +123,7 @@ return cell_list\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>portal_type=[], *argv, **kw</string> </value> <value> <string>portal_type=None, *argv, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -149,6 +152,7 @@ return cell_list\n ...@@ -149,6 +152,7 @@ return cell_list\n
<string>portal_type</string> <string>portal_type</string>
<string>argv</string> <string>argv</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>same_type</string> <string>same_type</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
...@@ -173,7 +177,7 @@ return cell_list\n ...@@ -173,7 +177,7 @@ return cell_list\n
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple> <tuple>
<list/> <none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -167,10 +167,12 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n ...@@ -167,10 +167,12 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n
if is_member_of(site_member_object, exclude_vault_type_item, strict=0) :\n if is_member_of(site_member_object, exclude_vault_type_item, strict=0) :\n
break\n break\n
else:\n else:\n
if first_level == 1 and site_member_object.getParentValue().getVaultType()==site_member_object.getVaultType():\n parent_value = site_member_object.getParentValue()\n
if first_level == 1 and getattr(parent_value, \'getVaultType\', None) is not None \\\n
and parent_value.getVaultType()==site_member_object.getVaultType():\n
pass\n pass\n
elif leaf_node == 1:\n elif leaf_node == 1:\n
if len(site_member_object) == 0:\n if len(site_member_object) == 0 or site_member_relative_url.endswith("auxiliaire/encaisse_des_externes"):\n
site_member_logical_path = site_member_object.getLogicalPath()\n site_member_logical_path = site_member_object.getLogicalPath()\n
vault_dict[site_member_relative_url] = [site_member_logical_path,site_member_relative_url]\n vault_dict[site_member_relative_url] = [site_member_logical_path,site_member_relative_url]\n
else:\n else:\n
......
...@@ -93,6 +93,14 @@ def get_fast_input_discriminant(line_id):\n ...@@ -93,6 +93,14 @@ def get_fast_input_discriminant(line_id):\n
return (cash_currency.getPortalType(), -cash_currency.getBasePrice(), line_id) # First sort by base price (desc), then by line id (asc)\n return (cash_currency.getPortalType(), -cash_currency.getBasePrice(), line_id) # First sort by base price (desc), then by line id (asc)\n
return line_id\n return line_id\n
\n \n
def sort_container(x, y):\n
x = listbox.get(x)\n
y = listbox.get(y)\n
result = cmp(x.get(\'date\'), y.get(\'date\'))\n
if result == 0:\n
result = cmp(x.get(\'reference\'),y.get(\'reference\'))\n
return result\n
\n
def sort_fast_input_lines(x, y):\n def sort_fast_input_lines(x, y):\n
criterion_x = get_fast_input_discriminant(x)\n criterion_x = get_fast_input_discriminant(x)\n
criterion_y = get_fast_input_discriminant(y)\n criterion_y = get_fast_input_discriminant(y)\n
...@@ -111,7 +119,11 @@ if hasattr(request, \'listbox\'):\n ...@@ -111,7 +119,11 @@ if hasattr(request, \'listbox\'):\n
\n \n
if keys_list != []:\n if keys_list != []:\n
#keys_list.sort(lambda x,y: cmp(int(x),int(y)))\n #keys_list.sort(lambda x,y: cmp(int(x),int(y)))\n
keys_list.sort(sort_fast_input_lines)\n if context.getPortalType() in (\'Monetary Issue\',):\n
keys_list.sort(sort_container)\n
pass\n
else:\n
keys_list.sort(sort_fast_input_lines)\n
first_empty_line_id = int(keys_list[-1])+1\n first_empty_line_id = int(keys_list[-1])+1\n
\n \n
for i in keys_list:\n for i in keys_list:\n
...@@ -210,6 +222,7 @@ return l\n ...@@ -210,6 +222,7 @@ return l\n
<string>int_len</string> <string>int_len</string>
<string>listbox</string> <string>listbox</string>
<string>get_fast_input_discriminant</string> <string>get_fast_input_discriminant</string>
<string>sort_container</string>
<string>sort_fast_input_lines</string> <string>sort_fast_input_lines</string>
<string>hasattr</string> <string>hasattr</string>
<string>keys_list</string> <string>keys_list</string>
......
380 381
\ 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