Commit 8d9f0270 authored by Jérome Perrin's avatar Jérome Perrin

accounting: set portal_status_level in error case of dialog actions

parent 38935ab5
...@@ -22,8 +22,11 @@ portal.portal_selections.setSelectionParamsFor('accounting_create_related_paymen ...@@ -22,8 +22,11 @@ portal.portal_selections.setSelectionParamsFor('accounting_create_related_paymen
if len(object_list) >= 1000: if len(object_list) >= 1000:
return context.Base_redirect( return context.Base_redirect(
form_id, form_id,
keep_items={'portal_status_message': translateString( keep_items={
'Refusing to process more than 1000 objects, check your selection.')}) 'portal_status_message': translateString(
'Refusing to process more than 1000 objects, check your selection.'),
'portal_status_level': 'error',
})
tag = 'payment_creation_%s' % random.randint(0, 1000) tag = 'payment_creation_%s' % random.randint(0, 1000)
activated = 0 activated = 0
...@@ -35,8 +38,10 @@ for obj in object_list: ...@@ -35,8 +38,10 @@ for obj in object_list:
return context.Base_redirect( return context.Base_redirect(
form_id, form_id,
abort_transaction=True, abort_transaction=True,
keep_items={'portal_status_message': translateString( keep_items={
'Payment creation already in progress, abandon.')}) 'portal_status_message': translateString('Payment creation already in progress, abandon.'),
'portal_status_level': 'error',
})
obj.activate(tag=tag).Invoice_createRelatedPaymentTransaction( obj.activate(tag=tag).Invoice_createRelatedPaymentTransaction(
node=node, node=node,
payment_mode=payment_mode, payment_mode=payment_mode,
...@@ -47,8 +52,10 @@ for obj in object_list: ...@@ -47,8 +52,10 @@ for obj in object_list:
if not activated: if not activated:
return context.Base_redirect( return context.Base_redirect(
form_id, form_id,
keep_items={'portal_status_message': translateString( keep_items={
'No invoice in your selection.')}) 'portal_status_message': translateString( 'No invoice in your selection.'),
'portal_status_level': 'error',
})
# activate something on the folder # activate something on the folder
context.activate(after_tag=tag).getTitle() context.activate(after_tag=tag).getTitle()
......
...@@ -13,9 +13,10 @@ else: ...@@ -13,9 +13,10 @@ else:
# XXX prevent to call this on the whole module: # XXX prevent to call this on the whole module:
if len(object_list) >= 1000: if len(object_list) >= 1000:
return context.Base_redirect(form_id, return context.Base_redirect(form_id,
keep_items=dict(portal_status_message= keep_items=dict(
translateString( portal_status_message=translateString('Refusing to process more than 1000 objects, check your selection.'),
'Refusing to process more than 1000 objects, check your selection.'))) portal_status_level='error',
))
tag = 'reversal_creation_%s' % random.randint(0, 1000) tag = 'reversal_creation_%s' % random.randint(0, 1000)
activated = 0 activated = 0
...@@ -36,9 +37,12 @@ for obj in object_list: ...@@ -36,9 +37,12 @@ for obj in object_list:
activated += 1 activated += 1
if not activated: if not activated:
return context.Base_redirect(form_id, return context.Base_redirect(
keep_items=dict(portal_status_message= form_id,
translateString('No valid transaction in your selection.'))) keep_items=dict(
portal_status_message=translateString('No valid transaction in your selection.'),
portal_status_level='error',
))
# activate something on the folder # activate something on the folder
context.activate(after_tag=tag).getTitle() context.activate(after_tag=tag).getTitle()
......
...@@ -18,9 +18,12 @@ for line in line_list: ...@@ -18,9 +18,12 @@ for line in line_list:
# redirect to previous page without doing the conversion # redirect to previous page without doing the conversion
if exchange_rate is None: if exchange_rate is None:
return context.Base_redirect(form_id, return context.Base_redirect(
keep_items=dict( form_id,
portal_status_message=context.Base_translateString('No exchange ratio found.'))) keep_items=dict(
portal_status_message=context.Base_translateString('No exchange ratio found.'),
portal_status_level='error',
))
# update the corresponding price and round it according to the precision of # update the corresponding price and round it according to the precision of
# the converted currency # the converted currency
......
...@@ -20,10 +20,12 @@ for line in line_list: ...@@ -20,10 +20,12 @@ for line in line_list:
start_date=line.getStartDate())) start_date=line.getStartDate()))
# redirect to previous page without doing the conversion # redirect to previous page without doing the conversion
if exchange_rate is None: if exchange_rate is None:
return context.Base_redirect(form_id, return context.Base_redirect(
keep_items=dict( form_id,
portal_status_message=context.Base_translateString('No exchange ratio found.'))) keep_items=dict(
portal_status_message=context.Base_translateString('No exchange ratio found.'),
portal_status_level='error',
))
# update the corresponding price and round it according to the precision of # update the corresponding price and round it according to the precision of
# the converted currency # the converted currency
......
...@@ -37,7 +37,10 @@ if sum(total_payable_price_details.values()) == 0: ...@@ -37,7 +37,10 @@ if sum(total_payable_price_details.values()) == 0:
if not batch_mode: if not batch_mode:
return context.Base_redirect( return context.Base_redirect(
form_id, form_id,
keep_items={'portal_status_message': Base_translateString('Nothing more to pay.')}) keep_items={
'portal_status_message': Base_translateString('Nothing more to pay.'),
'portal_status_level': 'error'
})
return None return None
related_payment = portal.accounting_module.newContent( related_payment = portal.accounting_module.newContent(
......
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