From ae01503a9e8814ef101f6955c3409b24f0fecedc Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 7 May 2021 07:20:43 +0200 Subject: [PATCH] handeling data in an inheritable way --- InvenTree/part/views.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 040f32d441..710b434c82 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -2067,10 +2067,14 @@ class PartPricing(AjaxView): # TODO - How to handle pricing in different currencies? currency = None + # check if data is set + try: + data = self.data + except Exception as _e: + data = {} + # Always mark the form as 'invalid' (the user may wish to keep getting pricing data) - data = { - 'form_valid': False, - } + data['form_valid'] = False return self.renderJsonResponse(request, form, data=data, context=self.get_pricing(quantity, currency))