Commit a57b0073 authored by Aurel's avatar Aurel

2006-07-03 aurel

* update generic fast input script

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8277 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a4b9f12
......@@ -359,7 +359,8 @@ else :\n
# compute the price for existing line\n
quantity = 0\n
for column_nb in xrange(1, len(column_base_list) + 1):\n
quantity += line[\'column%s\' %(str(column_nb))]\n
if line[\'column%s\' %(str(column_nb))] != \'\' and line[\'column%s\' %(str(column_nb))] is not None:\n
quantity += line[\'column%s\' %(str(column_nb))]\n
line[\'price\'] = resource_price * quantity\n
total_price += line[\'price\']\n
# add current line\n
......
......@@ -167,6 +167,7 @@ for line in listbox:\n
per_resource_dict[resource_id] = {movement_key:movement,}\n
\n
# create the movement\n
variation_not_defined = 0\n
for resource_id in per_resource_dict.keys():\n
variation_list_dict = per_resource_dict[resource_id].values()\n
# get the resource\n
......@@ -186,7 +187,8 @@ for resource_id in per_resource_dict.keys():\n
# check if variation exist for the resource\n
if column_base_category == "variation":\n
if variation != \'variation/not_defined\' and variation.lstrip(\'variation/\') not in resource_object.getVariationList():\n
raise "InputError", "%s doesn\\\'t exist for %s" %(resource_object.getTitle(), variation)\n
variation_not_defined = 1\n
break\n
if not emission_letter_dict.has_key(letter):\n
emission_letter_dict[letter] = 1\n
if not cash_status_dict.has_key(status):\n
......@@ -250,12 +252,22 @@ for resource_id in per_resource_dict.keys():\n
else:\n
cell.setQuantity(variation_item["quantity"])\n
\n
\n
request = context.REQUEST\n
redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n
, \'portal_status_message=Lines Created\'\n
if variation_not_defined:\n
old_line = [x.getObject() for x in context.Delivery_getMovementList(portal_type=[line_portal_type,])]\n
if len(old_line)>0:\n
for object_list in old_line:\n
context.deleteContent(object_list.getId())\n
request = context.REQUEST\n
redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n
, "portal_status_message=%s doesn\\\'t exist for %s" %(resource_object.getTitle(), variation)\n
)\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n
else:\n
request = context.REQUEST\n
redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n
, \'portal_status_message=Lines Created\'\n
)\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n
]]></string> </value>
......@@ -354,6 +366,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<string>_write_</string>
<string>movement_key</string>
<string>resource_id</string>
<string>variation_not_defined</string>
<string>variation_list_dict</string>
<string>resource_list</string>
<string>resource_object</string>
......
......@@ -86,6 +86,8 @@ if len(line_list) == 0:\n
invert = 1\n
if len(line_list) == 0:\n
return []\n
if len(portal_type) == 1:\n
return line_list\n
cell_list = []\n
for line in line_list:\n
if invert:\n
......
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