Commit 06699cc8 authored by Fabien Morin's avatar Fabien Morin

translate messages from ApparelModel_copyApparelColourRangeVariation

fix ApparelModel_copyComposition script to create cells in a good way

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31135 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6617a953
...@@ -55,9 +55,10 @@ ...@@ -55,9 +55,10 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n <value> <string>request = context.REQUEST\n
apparel_colour_range = context.getSpecialiseValue(portal_type=(\'Apparel Colour Range\',))\n apparel_colour_range = context.getSpecialiseValue(portal_type=(\'Apparel Colour Range\',))\n
msg = context.Base_translateString(\'No Apparel Model Colour Variation found.\')\n
\n \n
if apparel_colour_range is None:\n if apparel_colour_range is None:\n
msg = \'No Apparel Colour Range defined.\'\n msg = context.Base_translateString(\'Apparel Colour Range must be defined.\')\n
else:\n else:\n
apparel_colour_range_variation_list = map( lambda x: x.getObject(), apparel_colour_range.searchFolder(portal_type=(\'Apparel Colour Range Variation\',)))\n apparel_colour_range_variation_list = map( lambda x: x.getObject(), apparel_colour_range.searchFolder(portal_type=(\'Apparel Colour Range Variation\',)))\n
\n \n
...@@ -65,7 +66,6 @@ else:\n ...@@ -65,7 +66,6 @@ else:\n
apparel_model_colour_variation_title_list = map( lambda x: x.getObject().getTitle(), apparel_model_colour_variation_list)\n apparel_model_colour_variation_title_list = map( lambda x: x.getObject().getTitle(), apparel_model_colour_variation_list)\n
\n \n
count = 0\n count = 0\n
\n
for apparel_colour_range_variation in apparel_colour_range_variation_list:\n for apparel_colour_range_variation in apparel_colour_range_variation_list:\n
if apparel_colour_range_variation.getTitle() not in apparel_model_colour_variation_title_list:\n if apparel_colour_range_variation.getTitle() not in apparel_model_colour_variation_title_list:\n
count += 1\n count += 1\n
...@@ -78,9 +78,7 @@ else:\n ...@@ -78,9 +78,7 @@ else:\n
)\n )\n
\n \n
if count != 0:\n if count != 0:\n
msg = \'Creating %s Apparel Model Colour Variation.\' % count\n msg = \'%s %s\' % (count, context.Base_translateString(\'Items created.\'))\n
else:\n
msg = \'No new Apparel Colour Range Variation defined.\'\n
\n \n
context.Base_redirect(form_id=form_id,\n context.Base_redirect(form_id=form_id,\n
keep_items=dict(portal_status_message=msg))\n keep_items=dict(portal_status_message=msg))\n
...@@ -125,8 +123,8 @@ context.Base_redirect(form_id=form_id,\n ...@@ -125,8 +123,8 @@ context.Base_redirect(form_id=form_id,\n
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>apparel_colour_range</string> <string>apparel_colour_range</string>
<string>None</string>
<string>msg</string> <string>msg</string>
<string>None</string>
<string>map</string> <string>map</string>
<string>apparel_colour_range_variation_list</string> <string>apparel_colour_range_variation_list</string>
<string>apparel_model_colour_variation_list</string> <string>apparel_model_colour_variation_list</string>
......
...@@ -53,33 +53,48 @@ ...@@ -53,33 +53,48 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>cell_id_list = []\n <value> <string>\'\'\'\n
This script is used to copy composition from a related Apparel Fabric Colour\n
Variation to the current object.\n
\'\'\'\n
\n
cell_id_list = []\n
msg = context.Base_translateString(\'No Composition found.\')\n
colour_range = context.getSpecialiseValue(portal_type=\'Apparel Colour Range\')\n colour_range = context.getSpecialiseValue(portal_type=\'Apparel Colour Range\')\n
if colour_range is not None and len(colour_range.contentValues(portal_type=\'Apparel Colour Range Variation\')) != 0:\n if colour_range is None:\n
msg = context.Base_translateString(\'Apparel Colour Range must be defined\')\n
\n
elif len(colour_range.contentValues(portal_type=\'Apparel Colour Range Variation\')) != 0:\n
colour_variation = colour_range.contentValues(portal_type=\'Apparel Colour Range Variation\')[0]\n colour_variation = colour_range.contentValues(portal_type=\'Apparel Colour Range Variation\')[0]\n
apparel_fabric_colour_variation = colour_variation.getSpecialiseValue(portal_type=\'Apparel Fabric Colour Variation\')\n variation_line_list = colour_variation.contentValues(portal_type="Apparel Colour Range Variation Line",\n
if apparel_fabric_colour_variation is not None:\n sort_on=\'int_index\')\n
fabric = apparel_fabric_colour_variation.getParentValue()\n if len(variation_line_list):\n
composition_list = fabric.getCompositionList()\n # the first one is the most important one\n
# get cells\n # take composition only from the first one\n
poly_list = fabric.ApparelFabric_asCellRange(matrixbox=1)[0]\n variation_line = variation_line_list[0]\n
for cat, title in poly_list:\n apparel_fabric_colour_variation = variation_line.getSpecialiseValue(portal_type=\'Apparel Fabric Colour Variation\')\n
cell = fabric.getCell(cat, base_id=\'composition\')\n if apparel_fabric_colour_variation is not None:\n
if cell is not None:\n fabric = apparel_fabric_colour_variation.getParentValue()\n
cell_id_list.append(cell.getId())\n composition_list = fabric.getCompositionList()\n
# get cells\n
poly_list = fabric.ApparelFabric_asCellRange(matrixbox=1)[0]\n
context.setCompositionList(composition_list)\n
#context.setVariationBaseCategoryList([\'composition\',])\n
context.setCellRange(base_id=\'composition\', *context.ApparelFabric_asCellRange(matrixbox=False))\n
\n \n
if len(cell_id_list):\n for cat, title in poly_list:\n
copy_data = fabric.manage_copyObjects(cell_id_list)\n cell = fabric.getCell(cat, base_id=\'composition\')\n
context.manage_pasteObjects(copy_data)\n if cell is not None:\n
context.setCompositionList(composition_list)\n new_cell = context.newCell(cat, base_id=\'composition\',\n
msg = \'%s %s\' % (len(cell_id_list), context.Base_translateString(\'Composition Pasted.\'))\n portal_type=\'Mapped Value\')\n
else:\n new_cell.setQuantity(cell.getQuantity())\n
msg = \'No Composition found\'\n if len(poly_list):\n
msg = \'%s %s\' % (len(poly_list), context.Base_translateString(\'Items pasted.\'))\n
else:\n
msg = context.Base_translateString(\'No Composition found.\')\n
\n \n
return context.Base_redirect(form_id=form_id,\n return context.Base_redirect(form_id=form_id,\n
keep_items = dict(portal_status_message=msg,\n keep_items = dict(portal_status_message=msg))\n
editable_mode = context.REQUEST.get(\'editable_mode\', 0)))\n
return msg\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -120,21 +135,25 @@ return msg\n ...@@ -120,21 +135,25 @@ return msg\n
<string>cell_id_list</string> <string>cell_id_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>msg</string>
<string>colour_range</string> <string>colour_range</string>
<string>None</string> <string>None</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>colour_variation</string> <string>colour_variation</string>
<string>variation_line_list</string>
<string>variation_line</string>
<string>apparel_fabric_colour_variation</string> <string>apparel_fabric_colour_variation</string>
<string>fabric</string> <string>fabric</string>
<string>composition_list</string> <string>composition_list</string>
<string>poly_list</string> <string>poly_list</string>
<string>_apply_</string>
<string>False</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>cat</string> <string>cat</string>
<string>title</string> <string>title</string>
<string>cell</string> <string>cell</string>
<string>copy_data</string> <string>new_cell</string>
<string>msg</string>
<string>dict</string> <string>dict</string>
</tuple> </tuple>
</value> </value>
......
230 231
\ 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