Commit 66499d9e authored by Jérome Perrin's avatar Jérome Perrin

trade: set portal_status_level in error case of dialog actions

parent 8d9f0270
Pipeline #12008 passed with stage
in 0 seconds
......@@ -28,16 +28,22 @@ elif line_portal_type in portal.getPortalInternalTypeList() + portal.getPortalIn
else:
from Products.ERP5Type.Message import translateString
return context.Base_redirect('view', keep_items=dict(
portal_status_message=translateString('Type of document not known to retrieve section.')))
portal_status_message=translateString('Type of document not known to retrieve section.'),
portal_status_level='error',
))
if len(use_list) == 0:
from Products.ERP5Type.Message import translateString
return context.Base_redirect('view', keep_items=dict(
portal_status_message=translateString('Use preference must be defined.')))
portal_status_message=translateString('Use preference must be defined.'),
portal_status_level='error',
))
if section_uid is None:
from Products.ERP5Type.Message import translateString
return context.Base_redirect('view', keep_items=dict(
portal_status_message=translateString('Section must be defined.')))
portal_status_message=translateString('Section must be defined.'),
portal_status_level='error',
))
return context.Base_renderForm('Delivery_viewDeliveryFastInputDialog', *args, **kw)
......@@ -64,8 +64,10 @@ while count > 0 and len(trade_condition_list) == 0:
tested_base_category_list=tested_base_category_list[:count],
sort_method=sort_method)
if len(trade_condition_list ) == 0:
message = Base_translateString('No trade condition.')
keep_items = {}
if len(trade_condition_list ) == 0 :
keep_items['portal_status_message'] = Base_translateString('No trade condition.')
keep_items['portal_status_level'] = 'error'
else :
# if more than one trade condition is found, simply apply the first one
trade_condition=trade_condition_list[0].getObject()
......@@ -75,8 +77,7 @@ else :
if hasattr(order, 'getReceivedDate') and order.getReceivedDate() is None:
context.setReceivedDate(DateTime())
message = Base_translateString('Order updated.')
keep_items['portal_status_message'] = Base_translateString('Order updated.')
if not batch_mode:
return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=message))
return context.Base_redirect(form_id, keep_items=keep_items)
......@@ -120,7 +120,10 @@ if error is None:
if error is not None:
previous_skin_selection = container.REQUEST.get('previous_skin_selection', None)
context.getPortalObject().changeSkin(previous_skin_selection)
return context.Base_redirect('view', keep_items={'portal_status_message': context.Base_translateString(error, mapping=error_kw)})
return context.Base_redirect('view', keep_items={
'portal_status_message': context.Base_translateString(error, mapping=error_kw),
'portal_status_level': 'error',
})
# Add a line for unit titles
for source_trade in source_trade_dict:
......
......@@ -55,16 +55,18 @@ while count > 0 and len(trade_condition_list) == 0:
tested_base_category_list=tested_base_category_list[:count],
sort_method=sort_method)
keep_items = {}
if len(trade_condition_list ) == 0 :
message = Base_translateString('No trade condition.')
keep_items['portal_status_message'] = Base_translateString('No trade condition.')
keep_items['portal_status_level'] = 'error'
else :
# if more than one trade condition is found, simply apply the first one
trade_condition=trade_condition_list[0].getObject()
order.Order_applyTradeCondition(trade_condition, force=force)
message = Base_translateString('Order updated.')
keep_items['portal_status_message'] = Base_translateString('Order updated.')
if not batch_mode:
return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=message))
return context.Base_redirect(form_id, keep_items=keep_items)
......@@ -55,8 +55,10 @@ while count > 0 and len(trade_condition_list) == 0:
tested_base_category_list=tested_base_category_list[:count],
sort_method=sort_method)
if len(trade_condition_list ) == 0:
message = Base_translateString('No trade condition.')
keep_items = {}
if len(trade_condition_list ) == 0 :
keep_items['portal_status_message'] = Base_translateString('No trade condition.')
keep_items['portal_status_level'] = 'error'
else :
# if more than one trade condition is found, simply apply the first one
trade_condition=trade_condition_list[0].getObject()
......@@ -66,8 +68,7 @@ else :
if hasattr(order, 'getReceivedDate') and order.getReceivedDate() is None:
context.setReceivedDate(DateTime())
message = Base_translateString('Order updated.')
keep_items['portal_status_message'] = Base_translateString('Order updated.')
if not batch_mode:
return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=message))
return context.Base_redirect(form_id, keep_items=keep_items)
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