mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
style improvments
This commit is contained in:
parent
ae01503a9e
commit
9e59d41f12
@ -1633,23 +1633,22 @@ class LineItemPricing(PartPricing):
|
|||||||
return initials
|
return initials
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
response = None
|
|
||||||
# parse extra actions
|
# parse extra actions
|
||||||
REF = 'act-btn_'
|
REF = 'act-btn_'
|
||||||
act_btn = [a.replace(REF, '') for a in self.request.POST if REF in a]
|
act_btn = [a.replace(REF, '') for a in self.request.POST if REF in a]
|
||||||
|
|
||||||
# check if extra action was passed
|
# check if extra action was passed
|
||||||
if act_btn and act_btn[0] == 'update_price':
|
if act_btn and act_btn[0] == 'update_price':
|
||||||
# get sales order
|
# get sales order
|
||||||
so_line = self.get_so()
|
so_line = self.get_so()
|
||||||
if not so_line:
|
if not so_line:
|
||||||
self.data = {'non_field_errors':[_('Sales order not found')]}
|
self.data = {'non_field_errors': [_('Sales order not found')]}
|
||||||
else:
|
else:
|
||||||
quantity = self.get_quantity()
|
quantity = self.get_quantity()
|
||||||
price = self.get_pricing(quantity).get('unit_part_price', None)
|
price = self.get_pricing(quantity).get('unit_part_price', None)
|
||||||
|
|
||||||
if not price:
|
if not price:
|
||||||
self.data = {'non_field_errors':[_('Price not found')]}
|
self.data = {'non_field_errors': [_('Price not found')]}
|
||||||
else:
|
else:
|
||||||
# set normal update note
|
# set normal update note
|
||||||
note = _('Updated {part} unit-price to {price}')
|
note = _('Updated {part} unit-price to {price}')
|
||||||
@ -1672,4 +1671,3 @@ class LineItemPricing(PartPricing):
|
|||||||
|
|
||||||
# let the normal pricing view run
|
# let the normal pricing view run
|
||||||
return super().post(request, *args, **kwargs)
|
return super().post(request, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -2070,7 +2070,7 @@ class PartPricing(AjaxView):
|
|||||||
# check if data is set
|
# check if data is set
|
||||||
try:
|
try:
|
||||||
data = self.data
|
data = self.data
|
||||||
except Exception as _e:
|
except AttributeError:
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
# Always mark the form as 'invalid' (the user may wish to keep getting pricing data)
|
# Always mark the form as 'invalid' (the user may wish to keep getting pricing data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user