Commit 014d9519 authored by Nicolas Delaby's avatar Nicolas Delaby

Create Item if does not already exists

cell_portal_type is optional

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41901 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7c7e3b19
...@@ -89,15 +89,14 @@ for line in kw.get(\'listbox\'):\n ...@@ -89,15 +89,14 @@ for line in kw.get(\'listbox\'):\n
mapping={\'line_id\': line[\'listbox_key\']})\n mapping={\'line_id\': line[\'listbox_key\']})\n
return context.Base_redirect(form_id,\n return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=msg))\n keep_items=dict(portal_status_message=msg))\n
else:\n module = context.getDefaultModule(item_portal_type)\n
module = context.getDefaultModule(item_portal_type)\n item = module.newContent(portal_type=item_portal_type,\n
item = module.newContent(portal_type=item_portal_type,\n title=line[\'title\'],\n
title=line[\'title\'],\n reference=item_reference,\n
reference=item_reference,\n quantity=line.get(\'quantity\'),\n
quantity=line.get(\'quantity\'),\n quantity_unit=context.getQuantityUnit(),\n
quantity_unit=context.getQuantityUnit(),\n **item_property_dict)\n
**item_property_dict)\n \n
\n
line_variation_category_list = []\n line_variation_category_list = []\n
for variation in (\n for variation in (\n
line.get(\'line_variation_category_list\'),\n line.get(\'line_variation_category_list\'),\n
...@@ -122,7 +121,6 @@ for line in kw.get(\'listbox\'):\n ...@@ -122,7 +121,6 @@ for line in kw.get(\'listbox\'):\n
variation_category_list.append(variation)\n variation_category_list.append(variation)\n
context.setVariationCategoryList(variation_category_list)\n context.setVariationCategoryList(variation_category_list)\n
movement_to_update = context.newCell(base_id=\'movement\',\n movement_to_update = context.newCell(base_id=\'movement\',\n
portal_type=cell_portal_type,\n
*line_variation_category_list)\n *line_variation_category_list)\n
movement_to_update.edit(mapped_value_property_list=(\'quantity\', \'price\'),\n movement_to_update.edit(mapped_value_property_list=(\'quantity\', \'price\'),\n
variation_category_list=line_variation_category_list)\n variation_category_list=line_variation_category_list)\n
......
276 278
\ 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