Commit 2ed38d8f authored by Romain Courteaud's avatar Romain Courteaud

WIP BROKEN [erp5[_mrp]_item] new action

Do not access form submission REQUEST from the listbox list method,
as it is rendered asynchronously in ERP5JS
parent d30827cf
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
from Products.ERP5Type.Document import newTempDeliveryLine
portal = context.getPortalObject()
try:
count = int(context.REQUEST.get('field_your_item_count', ''))
except ValueError:
count = 10
result = []
for i in range(count):
for i in range(item_count):
obj = newTempDeliveryLine(portal, id="tmp_item_%s" % i, uid="new_item_%s" % i)
result.append(obj)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kw</string> </value>
<value> <string>item_count=10, *args, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -55,8 +55,10 @@ if message:
# Script stop here
context.Base_updateDialogForm(listbox=listbox,update=1, kw=kw)
REQUEST = portal.REQUEST
REQUEST.set('portal_status_message', message)
return getattr(context, REQUEST.form['dialog_id'])(listbox=listbox, kw=kw)
return context.Base_renderForm(
REQUEST.form['dialog_id'],
keep_items={'portal_status_message': message}
)
for item_uid in uids:
item = getObject(item_uid)
......
request = context.REQUEST
portal = context.getPortalObject()
Base_translateString = portal.Base_translateString
# FIXME: this is a workaround, because if listbox is present in request.form,
# editable fields will be empty when re-displaying the dialog.
request.form.pop('listbox', None)
request.other.pop('listbox', None)
return getattr(context, dialog_id)(**kw)
context.Base_updateDialogForm()
return context.Base_renderForm(
dialog_id,
keep_items={'portal_status_message': Base_translateString('Updated')}
)
......@@ -11,6 +11,7 @@
<value>
<list>
<string>columns</string>
<string>default_params</string>
<string>editable_columns</string>
<string>lines</string>
<string>list_method</string>
......@@ -62,6 +63,12 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value>
......@@ -77,7 +84,7 @@
<item>
<key> <string>lines</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
......@@ -130,6 +137,17 @@
</list>
</value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
<list>
<tuple>
<string>checked_permission</string>
<string>View</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
......@@ -176,7 +194,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
......@@ -214,12 +232,25 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: 0</string> </value>
<value> <string>python: [(\'checked_permission\', \'View\'), (\'item_count\', int(context.REQUEST.get(\'field_your_item_count\', \'10\')))]</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: 0</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_fast_input</string>
<string>action_type/object_jio_fast_input</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_fast_input</string> </value>
<value> <string>object_jio_fast_input</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -32,7 +32,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog</string> </value>
<value> <string>string:${object_url}/DeliveryLine_viewItemCreationDialog?reset:int=1</string> </value>
</item>
</dictionary>
</pickle>
......
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