mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
quantity also for modal
This commit is contained in:
parent
dc4fb64987
commit
b392586a08
@ -400,6 +400,8 @@ function setupCallbacks() {
|
||||
|
||||
$(".button-price").click(function() {
|
||||
var pk = $(this).attr('pk');
|
||||
var idx = $(this).closest('tr').attr('data-index');
|
||||
var row = table.bootstrapTable('getData')[idx];
|
||||
|
||||
launchModalForm(
|
||||
"{% url 'line-pricing' %}",
|
||||
@ -407,6 +409,7 @@ function setupCallbacks() {
|
||||
submit_text: '{% trans "Calculate price" %}',
|
||||
data: {
|
||||
line_item: pk,
|
||||
quantity: row.quantity,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -1960,7 +1960,18 @@ class PartPricing(AjaxView):
|
||||
def get_quantity(self):
|
||||
""" Return set quantity in decimal format """
|
||||
|
||||
return Decimal(self.request.POST.get('quantity', 1))
|
||||
# check POST
|
||||
qty = self.request.POST.get('quantity', None)
|
||||
|
||||
# check GET
|
||||
if not qty:
|
||||
qty = self.request.GET.get('quantity', None)
|
||||
|
||||
# nothing found: return 1
|
||||
if not qty:
|
||||
return Decimal(1)
|
||||
# return as decimal
|
||||
return Decimal(qty)
|
||||
|
||||
def get_part(self):
|
||||
try:
|
||||
@ -2048,7 +2059,8 @@ class PartPricing(AjaxView):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
return self.renderJsonResponse(request, self.form_class(), context=self.get_pricing())
|
||||
quantity = self.get_quantity()
|
||||
return self.renderJsonResponse(request, self.form_class(initial={'quantity': quantity}), context=self.get_pricing(quantity))
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user