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
CD_line_list = []\n
treated_container_list = []\n
line_number = 0\n
reference_list = []\n
ref_append = reference_list.append\n
for CD_line in CD_file_line_list:\n
line_number += 1\n
new_CD_line = string.replace(CD_line, \'\\n\', \'\')\n
......@@ -310,19 +312,20 @@ def split_lines(CD_file_line_list):\n
,\'range_stop\' : line_range_stop\n
,\'quantity\' : line_quantity}\n
)\n
ref_append(line_container_id)\n
\n
\n
# check reference doesn\'t already exist for this resource\n
movement_container_list = context.portal_catalog(portal_type = "Cash Container Item",\n
reference = line_container_id,\n
default_destination_uid = destination_uid,\n
simulation_state = "!=cancelled")\n
reference = reference_list,\n
simulation_state = ["empty", "draft", "rejected", "confirmed", "delivered",])\n
# if we find container line with same reference, we must\n
# check the resource defined on line\n
resource_uid = resource_value.getUid()\n
for same_container in movement_container_list:\n
same_container = same_container.getObject()\n
for o in same_container.objectValues():\n
if o.getResourceUid() == resource_value.getUid():\n
#context.log("same containter exist %s" %(o.getPath(), "AURELXXX"))\n
# raise ValueError, "same containter exist %s" %(o.getPath(),)\n
if o.getResourceUid() == resource_uid and o.getDestinationUid() == destination_uid:\n
return {\'error\':True, \'message\':message_dict[\'03\'], \'head_dict\':{}}\n
\n
\n
......
619
\ No newline at end of file
621
\ 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