Commit a5dcb27b authored by Romain Courteaud's avatar Romain Courteaud

[erp5_accounting] WIP: uids are deprecated

parent 0bf19426
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_button</string>
<string>action_type/object_jio_button</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_button</string> </value>
<value> <string>object_jio_button</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_exchange</string>
<string>action_type/object_jio_exchange</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_exchange</string> </value>
<value> <string>object_jio_exchange</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_button</string>
<string>action_type/object_jio_button</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_button</string> </value>
<value> <string>object_jio_button</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_button</string>
<string>action_type/object_jio_button</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_button</string> </value>
<value> <string>object_jio_button</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_button</string>
<string>action_type/object_jio_button</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_button</string> </value>
<value> <string>object_jio_button</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......
......@@ -4,9 +4,13 @@ portal = context.getPortalObject()
countMessage = portal.portal_activities.countMessage
invoice_type_list = portal.getPortalInvoiceTypeList()
portal.portal_selections.updateSelectionCheckedUidList(selection_name, listbox_uid, uids)
selection_uid_list = portal.portal_selections.getSelectionCheckedUidsFor(
selection_name)
if selection_name:
portal.portal_selections.updateSelectionCheckedUidList(selection_name, listbox_uid, uids)
selection_uid_list = portal.portal_selections.getSelectionCheckedUidsFor(
selection_name)
else:
selection_uid_list = uids
if selection_uid_list:
object_list = [brain.getObject() for brain in portal.portal_catalog(uid=selection_uid_list)]
else:
......@@ -20,10 +24,9 @@ portal.portal_selections.setSelectionParamsFor('accounting_create_related_paymen
# XXX prevent to call this on the whole module:
if len(object_list) >= 1000:
return context.Base_redirect(
form_id,
keep_items={'portal_status_message': translateString(
'Refusing to process more than 1000 objects, check your selection.')})
return context.Base_renderMessage(
translateString('Refusing to process more than 1000 objects, check your selection.'),
'warning')
tag = 'payment_creation_%s' % random.randint(0, 1000)
activated = 0
......
......@@ -8,11 +8,13 @@ psm = Base_translateString('Nothing matches.')
request = container.REQUEST
# update selected uids
portal.portal_selections.updateSelectionCheckedUidList(
list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)
uids = portal.portal_selections.getSelectionCheckedUidsFor(list_selection_name)
if list_selection_name:
portal.portal_selections.updateSelectionCheckedUidList(
list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)
uids = portal.portal_selections.getSelectionCheckedUidsFor(list_selection_name)
# XXX when should it be validated ?
# Kato: It is already validated because this is Form Dialog script
if node == '':
node = context.REQUEST.get('field_your_node', node)
if mirror_section == '':
......@@ -22,13 +24,13 @@ if grouping == '':
grouping = request.get('your_grouping',
request.get('field_your_grouping',
grouping))
# edit selection for dialog parameters
portal.portal_selections.setSelectionParamsFor(
'grouping_reference_fast_input_selection',
params=dict(node=node,
grouping=grouping,
mirror_section=mirror_section))
if list_selection_name:
# edit selection for dialog parameters
portal.portal_selections.setSelectionParamsFor(
'grouping_reference_fast_input_selection',
params=dict(node=node,
grouping=grouping,
mirror_section=mirror_section))
# calculate total selected amount
total_selected_amount = 0
......@@ -42,9 +44,9 @@ if uids:
request.set('total_selected_amount', total_selected_amount)
if update:
request.set('portal_status_message', Base_translateString('Updated'))
return context.AccountingTransactionModule_viewGroupingFastInputDialog(request)
return context.Base_renderForm('AccountingTransactionModule_viewGroupingFastInputDialog',
keep_items={'portal_status_message': Base_translateString('Updated')})
# otherwise, try to group...
if grouping == 'grouping':
......@@ -53,9 +55,9 @@ if grouping == 'grouping':
if grouped_line_list:
psm = Base_translateString('${grouped_line_count} lines grouped.',
mapping=dict(grouped_line_count=len(grouped_line_list)))
# make sure nothing will be checked next time
portal.portal_selections.setSelectionCheckedUidsFor(list_selection_name, [])
if list_selection_name:
# make sure nothing will be checked next time
portal.portal_selections.setSelectionCheckedUidsFor(list_selection_name, [])
# we check if we can mark some transaction as payed.
transaction_list = {}
......@@ -119,8 +121,9 @@ else:
psm = Base_translateString('${ungrouped_line_count} lines ungrouped.',
mapping=dict(ungrouped_line_count=len(ungrouped_line_list)))
# make sure nothing will be checked next time
portal.portal_selections.setSelectionCheckedUidsFor(list_selection_name, [])
if list_selection_name:
# make sure nothing will be checked next time
portal.portal_selections.setSelectionCheckedUidsFor(list_selection_name, [])
request.set('portal_status_message', psm)
return context.AccountingTransactionModule_viewGroupingFastInputDialog(request)
return context.Base_renderForm('AccountingTransactionModule_viewGroupingFastInputDialog',
keep_items={'portal_status_message': psm})
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