mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
add in price modal in table
This commit is contained in:
parent
ee028ef925
commit
dc4fb64987
@ -296,7 +296,8 @@ $("#so-lines-table").inventreeTable({
|
|||||||
if (part.assembly) {
|
if (part.assembly) {
|
||||||
html += makeIconButton('fa-tools', 'button-build', row.part, '{% trans "Build stock" %}');
|
html += makeIconButton('fa-tools', 'button-build', row.part, '{% trans "Build stock" %}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html += makeIconButton('fa-dollar-sign icon-green', 'button-price', pk, '{% trans "Calculate price" %}');
|
||||||
}
|
}
|
||||||
|
|
||||||
html += makeIconButton('fa-edit icon-blue', 'button-edit', pk, '{% trans "Edit line item" %}');
|
html += makeIconButton('fa-edit icon-blue', 'button-edit', pk, '{% trans "Edit line item" %}');
|
||||||
@ -396,6 +397,20 @@ function setupCallbacks() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".button-price").click(function() {
|
||||||
|
var pk = $(this).attr('pk');
|
||||||
|
|
||||||
|
launchModalForm(
|
||||||
|
"{% url 'line-pricing' %}",
|
||||||
|
{
|
||||||
|
submit_text: '{% trans "Calculate price" %}',
|
||||||
|
data: {
|
||||||
|
line_item: pk,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -31,6 +31,7 @@ purchase_order_urls = [
|
|||||||
url(r'^new/', views.PurchaseOrderCreate.as_view(), name='po-create'),
|
url(r'^new/', views.PurchaseOrderCreate.as_view(), name='po-create'),
|
||||||
|
|
||||||
url(r'^order-parts/', views.OrderParts.as_view(), name='order-parts'),
|
url(r'^order-parts/', views.OrderParts.as_view(), name='order-parts'),
|
||||||
|
url(r'^pricing/', views.LineItemPricing.as_view(), name='line-pricing'),
|
||||||
|
|
||||||
# Display detail view for a single purchase order
|
# Display detail view for a single purchase order
|
||||||
url(r'^(?P<pk>\d+)/', include(purchase_order_detail_urls)),
|
url(r'^(?P<pk>\d+)/', include(purchase_order_detail_urls)),
|
||||||
|
@ -29,6 +29,7 @@ from part.models import Part
|
|||||||
from common.models import InvenTreeSetting
|
from common.models import InvenTreeSetting
|
||||||
|
|
||||||
from . import forms as order_forms
|
from . import forms as order_forms
|
||||||
|
from part.views import PartPricing
|
||||||
|
|
||||||
from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
|
from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
|
||||||
from InvenTree.helpers import DownloadFile, str2bool
|
from InvenTree.helpers import DownloadFile, str2bool
|
||||||
@ -1559,3 +1560,17 @@ class SalesOrderAllocationDelete(AjaxDeleteView):
|
|||||||
ajax_form_title = _("Remove allocation")
|
ajax_form_title = _("Remove allocation")
|
||||||
context_object_name = 'allocation'
|
context_object_name = 'allocation'
|
||||||
ajax_template_name = "order/so_allocation_delete.html"
|
ajax_template_name = "order/so_allocation_delete.html"
|
||||||
|
|
||||||
|
|
||||||
|
class LineItemPricing(PartPricing):
|
||||||
|
""" View for inspecting part pricing information """
|
||||||
|
|
||||||
|
def get_part(self):
|
||||||
|
if 'line_item' in self.request.GET:
|
||||||
|
try:
|
||||||
|
part_id = self.request.GET.get('line_item')
|
||||||
|
return SalesOrderLineItem.objects.get(id=part_id).part
|
||||||
|
except Part.DoesNotExist:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user