mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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):
|
class LineItemPricing(PartPricing):
|
||||||
""" View for inspecting part pricing information """
|
""" View for inspecting part pricing information """
|
||||||
|
|
||||||
|
class EnhancedForm(PartPricing.form_class):
|
||||||
|
pk = IntegerField(widget = HiddenInput())
|
||||||
|
|
||||||
|
form_class = EnhancedForm
|
||||||
|
|
||||||
def get_part(self):
|
def get_part(self):
|
||||||
if 'line_item' in self.request.GET:
|
if 'line_item' in self.request.GET:
|
||||||
try:
|
try:
|
||||||
@ -1584,6 +1589,12 @@ class LineItemPricing(PartPricing):
|
|||||||
return SalesOrderLineItem.objects.get(id=part_id).part
|
return SalesOrderLineItem.objects.get(id=part_id).part
|
||||||
except Part.DoesNotExist:
|
except Part.DoesNotExist:
|
||||||
return None
|
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:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -1594,3 +1605,7 @@ class LineItemPricing(PartPricing):
|
|||||||
return Decimal(self.request.POST.get('quantity', 1))
|
return Decimal(self.request.POST.get('quantity', 1))
|
||||||
return qty
|
return qty
|
||||||
|
|
||||||
|
def get_initials(self):
|
||||||
|
initials = super().get_initials()
|
||||||
|
initials['pk'] = self.get_part().id
|
||||||
|
return initials
|
||||||
|
Loading…
x
Reference in New Issue
Block a user