Commit 759de55c authored by Nicolas Delaby's avatar Nicolas Delaby

Clean up script.

* remove useless import
* delete unused variable
* avoid comparison of persistent object equality

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41884 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a56601b5
......@@ -53,12 +53,12 @@
<value> <string encoding="cdata"><![CDATA[
from Products.ERP5Type.Message import translateString\n
from DateTime import DateTime\n
\n
item_list = []\n
request = context.REQUEST\n
total_quantity = 0.0\n
now = DateTime().strftime(\'%d%m%y\')\n
item_portal_type = request[\'type\']\n
\n
item_portal_type = kw.get(\'type\')\n
\n
if context.getPortalType()==\'Purchase Packing List Line\':\n
cell_portal_type = \'Purchase Packing List Cell\'\n
......@@ -91,7 +91,7 @@ for line in kw.get(\'listbox\'):\n
\n
if line.has_key(\'listbox_key\') and (line[\'reference\'] not in (\'\', None)):\n
item = context.portal_catalog.getResultValue(\n
portal_type=\'Item\',\n
portal_type=item_portal_type,\n
reference=line[\'reference\'])\n
if item is not None:\n
msg = translateString("Reference Defined On Line ${line_id} already exists",\n
......@@ -141,7 +141,7 @@ for line in kw.get(\'listbox\'):\n
# no variation, we\'ll update the line itself\n
movement_to_update = context\n
\n
if item not in movement_to_update.getAggregateValueList():\n
if item.getRelativeUrl() not in movement_to_update.getAggregateList():\n
movement_to_update.setAggregateValueList(\n
movement_to_update.getAggregateValueList() + [item])\n
\n
......@@ -161,7 +161,7 @@ if update_quantity:\n
raise NotImplementedError(\n
\'Quantity unit from the movement differs from quantity\'\n
\' unit on the item\')\n
quantity += item.getQuantity(at_date = DateTime().Date())\n
quantity += item.getQuantity(at_date=DateTime())\n
movement.setQuantity(quantity)\n
\n
return context.Base_redirect(form_id, keep_items=dict(\n
......
273
\ No newline at end of file
274
\ 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