Commit 38de4ad8 authored by Jérome Perrin's avatar Jérome Perrin

- Change the fast input to create items to have 3 columns to select variations...

- Change the fast input to create items to have 3 columns to select variations instead of one multilistfield with all variations mixed.
- Use external validator on editable fields. If title or reference is set on the line, you must fill quantity and all variations

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27257 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8750027d
No related merge requests found
......@@ -75,11 +75,6 @@ base_id = \'movement\'\n
for line in kw.get(\'listbox\'):\n
\n
if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n
\n
if line[\'quantity\'] in (\'\',None):\n
msg = translateString("Please Define Quantity for Item Defined On Line ${line_id}",\n
mapping={\'line_id\': line[\'listbox_key\']})\n
raise NotImplementedError(msg)\n
\n
module = context.getDefaultModule(item_portal_type)\n
item = module.newContent(portal_type=item_portal_type,\n
......@@ -88,25 +83,35 @@ for line in kw.get(\'listbox\'):\n
quantity=line[\'quantity\'],\n
quantity_unit=context.getQuantityUnit())\n
item.validate()\n
\n
if line.has_key("variation_category_list") and line[\'variation_category_list\'] not in(\'\',[]):\n
cell_found = None\n
cell_found = context.getCell(base_id=\'movement\', *line["variation_category_list"])\n
\n
line_variation_category_list = []\n
for variation in (\n
line.get(\'line_variation_category_list\'),\n
line.get(\'tab_variation_category_list\'),\n
line.get(\'column_variation_category_list\'),):\n
if variation:\n
line_variation_category_list.append(variation)\n
\n
\n
if line_variation_category_list:\n
cell_found = context.getCell(base_id=\'movement\',\n
*line_variation_category_list)\n
if cell_found is not None:\n
movement_to_update = cell_found\n
else:\n
if not context.hasInRange(base_id=\'movement\', *line["variation_category_list"]):\n
if not context.hasInRange(base_id=\'movement\',\n
*line_variation_category_list):\n
# update line variation category list, if not already containing this one\n
variation_category_list = context.getVariationCategoryList()\n
for variation in line["variation_category_list"]:\n
for variation in line_variation_category_list:\n
if variation not in variation_category_list:\n
variation_category_list.append(variation)\n
context.setVariationCategoryList(variation_category_list)\n
movement_to_update = context.newCell(base_id=\'movement\',\n
portal_type=cell_portal_type,\n
*line["variation_category_list"])\n
portal_type=cell_portal_type,\n
*line_variation_category_list)\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
\n
else:\n
# no variation, we\'ll update the line itself\n
......@@ -193,20 +198,20 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>_getiter_</string>
<string>line</string>
<string>None</string>
<string>msg</string>
<string>NotImplementedError</string>
<string>module</string>
<string>item</string>
<string>cell_found</string>
<string>line_variation_category_list</string>
<string>variation</string>
<string>_apply_</string>
<string>cell_found</string>
<string>movement_to_update</string>
<string>variation_category_list</string>
<string>variation</string>
<string>update_quantity</string>
<string>movement_list</string>
<string>movement</string>
<string>quantity</string>
<string>len</string>
<string>NotImplementedError</string>
<string>_inplacevar_</string>
<string>dict</string>
</tuple>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
resolveCategory = context.getPortalObject().portal_categories.resolveCategory\n
column_item_list = [(\'title\', \'Title\'),\n
(\'reference\', \'Reference\'),\n
(\'quantity\', \'Quantity\'),]\n
\n
cell_range = context.getCellRange(base_id=\'movement\')\n
if len(cell_range) > 0:\n
column_item_list.append((\'line_variation_category_list\',\n
resolveCategory(cell_range[0][0].split(\'/\')[0]).getTitle()))\n
if len(cell_range) > 1:\n
column_item_list.append((\'column_variation_category_list\',\n
resolveCategory(cell_range[1][0].split(\'/\')[0]).getTitle()))\n
if len(cell_range) > 2:\n
column_item_list.append((\'tab_variation_category_list\',\n
resolveCategory(cell_range[2][0].split(\'/\')[0]).getTitle()))\n
\n
return column_item_list\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>resolveCategory</string>
<string>column_item_list</string>
<string>cell_range</string>
<string>len</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DeliveryLine_getItemCreationDialogListboxColumnList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if not editor and (\n
request.get(\'field_listbox_title_%s\' % request.cell.uid) or\n
request.get(\'field_listbox_reference_%s\' % request.cell.uid)):\n
return False\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>editor, request</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>editor</string>
<string>request</string>
<string>_getattr_</string>
<string>False</string>
<string>True</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DeliveryLine_validateItemCreationDialogEditableField</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -97,8 +97,10 @@
<string>listbox_title</string>
<string>listbox_reference</string>
<string>listbox_quantity</string>
<string>listbox_variation_category_list</string>
<string>matrixbox_quantity</string>
<string>listbox_column_variation_category_list</string>
<string>listbox_tab_variation_category_list</string>
<string>listbox_line_variation_category_list</string>
</list>
</value>
</item>
......
......@@ -185,7 +185,9 @@
</item>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>count_method</string> </key>
......@@ -267,6 +269,10 @@
<key> <string>report_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
......@@ -349,8 +355,16 @@
<string>Quantity</string>
</tuple>
<tuple>
<string>variation_category_list</string>
<string>Variation</string>
<string>line_variation_category_list</string>
<string>Variation 1</string>
</tuple>
<tuple>
<string>column_variation_category_list</string>
<string>Variation 2</string>
</tuple>
<tuple>
<string>tab_variation_category_list</string>
<string>Variation 3</string>
</tuple>
</list>
</value>
......@@ -404,8 +418,16 @@
<string>Quantity</string>
</tuple>
<tuple>
<string>variation_category_list</string>
<string>Variation</string>
<string>line_variation_category_list</string>
<string>Variation 1</string>
</tuple>
<tuple>
<string>column_variation_category_list</string>
<string>Variation 2</string>
</tuple>
<tuple>
<string>tab_variation_category_list</string>
<string>Variation 3</string>
</tuple>
</list>
</value>
......@@ -430,7 +452,7 @@
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>20</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>list_action</string> </key>
......@@ -439,7 +461,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
......@@ -468,6 +490,10 @@
<key> <string>report_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
......@@ -531,6 +557,22 @@
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>context/DeliveryLine_getItemCreationDialogListboxColumnList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
......
......@@ -12,7 +12,17 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>external_validator</string>
</list>
</value>
</item>
<item>
<key> <string>delegated_message_list</string> </key>
<value>
<list>
<string>external_validator_failed</string>
</list>
</value>
</item>
<item>
......@@ -25,7 +35,7 @@
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
......@@ -72,6 +82,12 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_quantity</string> </value>
......@@ -90,4 +106,20 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>DeliveryLine_validateItemCreationDialogEditableField</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,7 +3,7 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="MultiListField" module="Products.Formulator.StandardFields"/>
<global name="ListField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
......@@ -11,7 +11,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_variation_category_list</string> </value>
<value> <string>listbox_tab_variation_category_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -19,7 +19,7 @@
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
......@@ -72,6 +72,10 @@
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
......@@ -97,7 +101,7 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -145,6 +149,10 @@
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
......@@ -172,7 +180,7 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -192,9 +200,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -210,7 +216,9 @@
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>extra</string> </key>
......@@ -220,6 +228,10 @@
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
......@@ -236,7 +248,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>5</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -247,12 +259,8 @@
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
......@@ -271,7 +279,11 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getVariationRangeCategoryItemList(display_base_category = 0)</string> </value>
<value> <string encoding="cdata"><![CDATA[
python: len(context.getCellRange(base_id=\'movement\')) > 2
]]></string> </value>
</item>
</dictionary>
</pickle>
......@@ -287,7 +299,23 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getVariationRangeCategoryItemList(display_base_category = 0)</string> </value>
<value> <string>python: [(\'\', \'\')] + [(y, x) for (x, y) in context.DeliveryLine_asCellRange(matrixbox=1)[2]]</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>DeliveryLine_validateItemCreationDialogEditableField</string> </value>
</item>
</dictionary>
</pickle>
......
156
\ No newline at end of file
158
\ 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