Commit 269d2f80 authored by Jérome Perrin's avatar Jérome Perrin

Use formbox on Item_view for extra item properties, and also on DeliveryLine_viewItemCreationDialog

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27269 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent baf7d7fc
...@@ -59,7 +59,9 @@ from Products.ERP5Type.Message import translateString\n ...@@ -59,7 +59,9 @@ from Products.ERP5Type.Message import translateString\n
item_list = []\n item_list = []\n
request = context.REQUEST\n request = context.REQUEST\n
total_quantity = 0.0\n total_quantity = 0.0\n
\n
item_portal_type = request[\'type\']\n item_portal_type = request[\'type\']\n
\n
if context.getPortalType()==\'Purchase Packing List Line\':\n if context.getPortalType()==\'Purchase Packing List Line\':\n
cell_portal_type = \'Purchase Packing List Cell\'\n cell_portal_type = \'Purchase Packing List Cell\'\n
elif context.getPortalType()==\'Purchase Order Line\' :\n elif context.getPortalType()==\'Purchase Order Line\' :\n
...@@ -69,6 +71,19 @@ elif context.getPortalType()==\'Sale Packing List Line\':\n ...@@ -69,6 +71,19 @@ elif context.getPortalType()==\'Sale Packing List Line\':\n
elif context.getPortalType()== \'Internal Packing List Line\':\n elif context.getPortalType()== \'Internal Packing List Line\':\n
cell_portal_type = \'Internal Packing List Cell\'\n cell_portal_type = \'Internal Packing List Cell\'\n
\n \n
item_property_dict = dict()\n
\n
# if the formbox for extra item properties is enabled, use it.\n
dialog = getattr(context, dialog_id)\n
if dialog.has_field(\'your_item_extra_property_list\'):\n
box = dialog.get_field(\'your_item_extra_property_list\')\n
form = getattr(context, box.get_value(\'formbox_target_id\'))\n
for field in form.get_fields():\n
field_id = field.getId()\n
if field_id.startswith(\'your_\'):\n
item_property_dict[field_id.replace(\'your_\', \'\', 1)] =\\\n
request.get(field_id)\n
\n
movement_cell_list = context.contentValues(portal_type=cell_portal_type)\n movement_cell_list = context.contentValues(portal_type=cell_portal_type)\n
base_id = \'movement\'\n base_id = \'movement\'\n
\n \n
...@@ -81,7 +96,8 @@ for line in kw.get(\'listbox\'):\n ...@@ -81,7 +96,8 @@ for line in kw.get(\'listbox\'):\n
title=line[\'title\'],\n title=line[\'title\'],\n
reference=line[\'reference\'],\n reference=line[\'reference\'],\n
quantity=line[\'quantity\'],\n quantity=line[\'quantity\'],\n
quantity_unit=context.getQuantityUnit())\n quantity_unit=context.getQuantityUnit(),\n
**item_property_dict)\n
item.validate()\n item.validate()\n
\n \n
line_variation_category_list = []\n line_variation_category_list = []\n
...@@ -154,7 +170,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -154,7 +170,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id=\'view\',*args, **kw</string> </value> <value> <string>form_id=\'view\', dialog_id=\'DeliveryLine_viewItemCreationDialog\', *args, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -174,13 +190,14 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -174,13 +190,14 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>form_id</string> <string>form_id</string>
<string>dialog_id</string>
<string>args</string> <string>args</string>
<string>kw</string> <string>kw</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
...@@ -193,16 +210,25 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -193,16 +210,25 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>_getitem_</string> <string>_getitem_</string>
<string>item_portal_type</string> <string>item_portal_type</string>
<string>cell_portal_type</string> <string>cell_portal_type</string>
<string>dict</string>
<string>item_property_dict</string>
<string>getattr</string>
<string>dialog</string>
<string>box</string>
<string>form</string>
<string>_getiter_</string>
<string>field</string>
<string>field_id</string>
<string>_write_</string>
<string>movement_cell_list</string> <string>movement_cell_list</string>
<string>base_id</string> <string>base_id</string>
<string>_getiter_</string>
<string>line</string> <string>line</string>
<string>None</string> <string>None</string>
<string>module</string> <string>module</string>
<string>_apply_</string>
<string>item</string> <string>item</string>
<string>line_variation_category_list</string> <string>line_variation_category_list</string>
<string>variation</string> <string>variation</string>
<string>_apply_</string>
<string>cell_found</string> <string>cell_found</string>
<string>movement_to_update</string> <string>movement_to_update</string>
<string>variation_category_list</string> <string>variation_category_list</string>
...@@ -213,7 +239,6 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -213,7 +239,6 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>len</string> <string>len</string>
<string>NotImplementedError</string> <string>NotImplementedError</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>dict</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -227,6 +252,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -227,6 +252,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<value> <value>
<tuple> <tuple>
<string>view</string> <string>view</string>
<string>DeliveryLine_viewItemCreationDialog</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
<list> <list>
<string>your_item_count</string> <string>your_item_count</string>
<string>your_type</string> <string>your_type</string>
<string>your_item_extra_property_list</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -3,25 +3,15 @@ ...@@ -3,25 +3,15 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/> <global name="FormBox" module="Products.ERP5Form.FormBox"/>
<tuple/> <tuple/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>timezone_style</string>
<string>input_order</string>
</list>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_expiration_date</string> </value> <value> <string>your_item_extra_property_list</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -31,6 +21,10 @@ ...@@ -31,6 +21,10 @@
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>The input failed the external validator.</string> </value>
</item> </item>
<item>
<key> <string>form_invalidated</string> </key>
<value> <string>Form invalidated.</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -39,15 +33,43 @@ ...@@ -39,15 +33,43 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>formbox_target_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -58,15 +80,45 @@ ...@@ -58,15 +80,45 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>formbox_target_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,28 +129,44 @@ ...@@ -77,28 +129,44 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>alternate_name</string> </key>
<value> <string>my_date</string> </value> <value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>enabled</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>input_order</string> </key> <key> <string>external_validator</string> </key>
<value> <string>dmy</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>formbox_target_id</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Item_viewExtraPropertyDialog</string> </value>
</item> </item>
<item> <item>
<key> <string>timezone_style</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Expiration Date</string> </value> <value> <string>Item Extra Properties</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
...@@ -106,4 +174,20 @@ ...@@ -106,4 +174,20 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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/Item_viewExtraPropertyDialog | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<string>my_variation_category_list</string> <string>my_variation_category_list</string>
<string>my_current_owner</string> <string>my_current_owner</string>
<string>my_current_site</string> <string>my_current_site</string>
<string>my_expiration_date</string> <string>your_item_extra_property_list</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="FormBox" module="Products.ERP5Form.FormBox"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_item_extra_property_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>form_invalidated</string> </key>
<value> <string>Form invalidated.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>formbox_target_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>formbox_target_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>formbox_target_id</string> </key>
<value> <string>Item_viewExtraProperty</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Item Extra Properties</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</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/Item_viewExtraProperty | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>string:</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
158 160
\ 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