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

2009-06-11 mame

*add condition on script to avoid creating items with the same reference
*checkConsistency before validation of item

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27519 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ccda9213
...@@ -90,7 +90,15 @@ base_id = \'movement\'\n ...@@ -90,7 +90,15 @@ base_id = \'movement\'\n
for line in kw.get(\'listbox\'):\n for line in kw.get(\'listbox\'):\n
\n \n
if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n
\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 module = context.getDefaultModule(item_portal_type)\n
item = module.newContent(portal_type=item_portal_type,\n item = module.newContent(portal_type=item_portal_type,\n
title=line[\'title\'],\n title=line[\'title\'],\n
...@@ -224,9 +232,11 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -224,9 +232,11 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>base_id</string> <string>base_id</string>
<string>line</string> <string>line</string>
<string>None</string> <string>None</string>
<string>item</string>
<string>msg</string>
<string>NotImplementedError</string>
<string>module</string> <string>module</string>
<string>_apply_</string> <string>_apply_</string>
<string>item</string>
<string>line_variation_category_list</string> <string>line_variation_category_list</string>
<string>variation</string> <string>variation</string>
<string>cell_found</string> <string>cell_found</string>
...@@ -237,7 +247,6 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -237,7 +247,6 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>movement</string> <string>movement</string>
<string>quantity</string> <string>quantity</string>
<string>len</string> <string>len</string>
<string>NotImplementedError</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
</tuple> </tuple>
</value> </value>
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
<dictionary/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>scripts</string> </value> <value> <string>scripts</string> </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>object = state_change[\'object\']\n
object.Base_checkConsistency()\n
</string> </value>
</item>
<item>
<key> <string>_code</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>_getitem_</string>
<string>object</string>
<string>_getattr_</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>checkConsistency</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string></string> </value> <value> <string>checkConsistency</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
167 168
\ 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