From 96a050a963ea8841126d9788e51b6af7e53a203f Mon Sep 17 00:00:00 2001 From: mdietrichc2c Date: Mon, 1 May 2017 17:09:06 +0200 Subject: [PATCH] Add pick/pack info to all exceptions --- .../wizard/generate_labels.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/delivery_carrier_label_batch/wizard/generate_labels.py b/delivery_carrier_label_batch/wizard/generate_labels.py index 58cdc6f60d..69977aea39 100644 --- a/delivery_carrier_label_batch/wizard/generate_labels.py +++ b/delivery_carrier_label_batch/wizard/generate_labels.py @@ -99,13 +99,12 @@ def _do_generate_labels(self, pack, picking, label): package_ids=package_ids ) except Exception as e: - if isinstance(e, exceptions.UserError): - # add information on picking and pack in the exception - picking_name = _('Picking: %s') % picking.name - pack_num = _('Pack: %s') % pack.name if pack else '' - raise exceptions.UserError( - ('%s %s - %s') % (picking_name, pack_num, e.message) - ) + # add information on picking and pack in the exception + picking_name = _('Picking: %s') % picking.name + pack_num = _('Pack: %s') % pack.name if pack else '' + raise exceptions.UserError( + ('%s %s - %s') % (picking_name, pack_num, e) + ) def _worker(self, data_queue, error_queue): """ A worker to generate labels