mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
keeping part id in inherited form
This commit is contained in:
parent
4830ff28bf
commit
90c207b935
@ -1577,6 +1577,11 @@ class SalesOrderAllocationDelete(AjaxDeleteView):
|
||||
class LineItemPricing(PartPricing):
|
||||
""" View for inspecting part pricing information """
|
||||
|
||||
class EnhancedForm(PartPricing.form_class):
|
||||
pk = IntegerField(widget = HiddenInput())
|
||||
|
||||
form_class = EnhancedForm
|
||||
|
||||
def get_part(self):
|
||||
if 'line_item' in self.request.GET:
|
||||
try:
|
||||
@ -1584,6 +1589,12 @@ class LineItemPricing(PartPricing):
|
||||
return SalesOrderLineItem.objects.get(id=part_id).part
|
||||
except Part.DoesNotExist:
|
||||
return None
|
||||
elif 'pk' in self.request.POST:
|
||||
try:
|
||||
part_id = self.request.POST.get('pk')
|
||||
return Part.objects.get(id=part_id)
|
||||
except Part.DoesNotExist:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
@ -1594,3 +1605,7 @@ class LineItemPricing(PartPricing):
|
||||
return Decimal(self.request.POST.get('quantity', 1))
|
||||
return qty
|
||||
|
||||
def get_initials(self):
|
||||
initials = super().get_initials()
|
||||
initials['pk'] = self.get_part().id
|
||||
return initials
|
||||
|
Loading…
Reference in New Issue
Block a user