Commit d011a725 authored by Aurel's avatar Aurel

group sql request into one when checking for already loaded references

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21320 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ecd3865f
...@@ -280,6 +280,8 @@ def split_lines(CD_file_line_list):\n ...@@ -280,6 +280,8 @@ def split_lines(CD_file_line_list):\n
CD_line_list = []\n CD_line_list = []\n
treated_container_list = []\n treated_container_list = []\n
line_number = 0\n line_number = 0\n
reference_list = []\n
ref_append = reference_list.append\n
for CD_line in CD_file_line_list:\n for CD_line in CD_file_line_list:\n
line_number += 1\n line_number += 1\n
new_CD_line = string.replace(CD_line, \'\\n\', \'\')\n new_CD_line = string.replace(CD_line, \'\\n\', \'\')\n
...@@ -310,20 +312,21 @@ def split_lines(CD_file_line_list):\n ...@@ -310,20 +312,21 @@ def split_lines(CD_file_line_list):\n
,\'range_stop\' : line_range_stop\n ,\'range_stop\' : line_range_stop\n
,\'quantity\' : line_quantity}\n ,\'quantity\' : line_quantity}\n
)\n )\n
# check reference doesn\'t already exist for this resource\n ref_append(line_container_id)\n
movement_container_list = context.portal_catalog(portal_type = "Cash Container Item",\n \n
reference = line_container_id,\n \n
default_destination_uid = destination_uid,\n # check reference doesn\'t already exist for this resource\n
simulation_state = "!=cancelled")\n movement_container_list = context.portal_catalog(portal_type = "Cash Container Item",\n
# if we find container line with same reference, we must\n reference = reference_list,\n
# check the resource defined on line\n simulation_state = ["empty", "draft", "rejected", "confirmed", "delivered",])\n
for same_container in movement_container_list:\n # if we find container line with same reference, we must\n
same_container = same_container.getObject()\n # check the resource defined on line\n
for o in same_container.objectValues():\n resource_uid = resource_value.getUid()\n
if o.getResourceUid() == resource_value.getUid():\n for same_container in movement_container_list:\n
#context.log("same containter exist %s" %(o.getPath(), "AURELXXX"))\n same_container = same_container.getObject()\n
# raise ValueError, "same containter exist %s" %(o.getPath(),)\n for o in same_container.objectValues():\n
return {\'error\':True, \'message\':message_dict[\'03\'], \'head_dict\':{}}\n if o.getResourceUid() == resource_uid and o.getDestinationUid() == destination_uid:\n
return {\'error\':True, \'message\':message_dict[\'03\'], \'head_dict\':{}}\n
\n \n
\n \n
if line_number > 0:\n if line_number > 0:\n
......
619 621
\ 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