[Erp5-report] r27519 - in /erp5/trunk/bt5/erp5_item: SkinTemplateItem/portal_skins/erp5_ite...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jun 11 12:44:17 CEST 2009


Author: mame
Date: Thu Jun 11 12:44:15 2009
New Revision: 27519

URL: http://svn.erp5.org?rev=27519&view=rev
Log:
2009-06-11 mame
*add condition on script to avoid creating items with the same reference
*checkConsistency before validation of item

Added:
    erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts/
    erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts/checkConsistency.xml
Modified:
    erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml
    erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts.xml
    erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/transitions/validate_action.xml
    erp5/trunk/bt5/erp5_item/bt/revision

Modified: erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml?rev=27519&r1=27518&r2=27519&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml [utf8] Thu Jun 11 12:44:15 2009
@@ -90,15 +90,23 @@
 for line in kw.get(\'listbox\'):\n
 \n
   if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n
-\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
+    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
     \n
     line_variation_category_list = []\n
     for variation in (\n
@@ -224,9 +232,11 @@
                             <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>
@@ -237,7 +247,6 @@
                             <string>movement</string>
                             <string>quantity</string>
                             <string>len</string>
-                            <string>NotImplementedError</string>
                             <string>_inplacevar_</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts.xml?rev=27519&r1=27518&r2=27519&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts.xml [utf8] Thu Jun 11 12:44:15 2009
@@ -16,6 +16,12 @@
             </value>
         </item>
         <item>
+            <key> <string>_objects</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
             <key> <string>id</string> </key>
             <value> <string>scripts</string> </value>
         </item>

Added: erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts/checkConsistency.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts/checkConsistency.xml?rev=27519&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts/checkConsistency.xml (added)
+++ erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/scripts/checkConsistency.xml [utf8] Thu Jun 11 12:44:15 2009
@@ -1,0 +1,125 @@
+<?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>

Modified: erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/transitions/validate_action.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/transitions/validate_action.xml?rev=27519&r1=27518&r2=27519&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/transitions/validate_action.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/WorkflowTemplateItem/portal_workflow/item_workflow/transitions/validate_action.xml [utf8] Thu Jun 11 12:44:15 2009
@@ -45,7 +45,7 @@
         </item>
         <item>
             <key> <string>script_name</string> </key>
-            <value> <string></string> </value>
+            <value> <string>checkConsistency</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>

Modified: erp5/trunk/bt5/erp5_item/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/bt/revision?rev=27519&r1=27518&r2=27519&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/bt/revision [utf8] Thu Jun 11 12:44:15 2009
@@ -1,1 +1,1 @@
-167
+168




More information about the Erp5-report mailing list