Commit f76ef201 authored by Mame Coumba Sall's avatar Mame Coumba Sall

2009-06-12 mame

*add ExternalValidation script to create only one reference for Item

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27545 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7f28d7a6
......@@ -90,23 +90,14 @@ base_id = \'movement\'\n
for line in kw.get(\'listbox\'):\n
\n
if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n
item = context.portal_catalog.getResultValue(\n
portal_type=\'Item\',\n
reference=line[\'reference\'])\n
if item is not None:\n
msg = translateString("Reference Defined On Line ${line_id} already exists",\n
mapping={\'line_id\': line[\'listbox_key\']})\n
raise NotImplementedError(\n
msg)\n
else:\n
module = context.getDefaultModule(item_portal_type)\n
item = module.newContent(portal_type=item_portal_type,\n
title=line[\'title\'],\n
reference=line[\'reference\'],\n
quantity=line[\'quantity\'],\n
quantity_unit=context.getQuantityUnit(),\n
**item_property_dict)\n
item.validate()\n
module = context.getDefaultModule(item_portal_type)\n
item = module.newContent(portal_type=item_portal_type,\n
title=line[\'title\'],\n
reference=line[\'reference\'],\n
quantity=line[\'quantity\'],\n
quantity_unit=context.getQuantityUnit(),\n
**item_property_dict)\n
item.validate()\n
\n
line_variation_category_list = []\n
for variation in (\n
......@@ -232,11 +223,9 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>base_id</string>
<string>line</string>
<string>None</string>
<string>item</string>
<string>msg</string>
<string>NotImplementedError</string>
<string>module</string>
<string>_apply_</string>
<string>item</string>
<string>line_variation_category_list</string>
<string>variation</string>
<string>cell_found</string>
......@@ -247,6 +236,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>movement</string>
<string>quantity</string>
<string>len</string>
<string>NotImplementedError</string>
<string>_inplacevar_</string>
</tuple>
</value>
......
<?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>Script_magic</string> </key>
<value> <int>3</int> </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>result = [x.getObject() for x in context.portal_catalog(portal_type = request.get("field_your_type"),\n
reference= request.get(\'field_listbox_reference_%s\' % request.cell.uid))]\n
if editor and result !=[]:\n
return False\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</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>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>x</string>
<string>result</string>
<string>False</string>
<string>True</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>DeliveryLine_validateItemCreationDialogReference</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -13,8 +13,17 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>display_width</string>
<string>external_validator</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>delegated_message_list</string> </key>
<value>
<list>
<string>external_validator_failed</string>
</list>
</value>
</item>
......@@ -28,7 +37,7 @@
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
<value> <string>The input failed the external validator because the reference already exists</string> </value>
</item>
</dictionary>
</value>
......@@ -79,6 +88,12 @@
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
......@@ -101,4 +116,20 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>DeliveryLine_validateItemCreationDialogReference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
168
\ No newline at end of file
169
\ 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