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