mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 03:00:54 +00:00
Merging master and resolved conflict
This commit is contained in:
@ -127,7 +127,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and item.owner == user or user.is_superuser %}
|
||||
{% if roles.stock.change and not item.is_building %}
|
||||
<div class='btn-group'>
|
||||
<button id='stock-options' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
|
||||
<button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
{% if item.in_stock %}
|
||||
{% if not item.serialized %}
|
||||
|
@ -538,7 +538,22 @@ class StockItemTestReportSelect(AjaxView):
|
||||
def get_form(self):
|
||||
|
||||
stock_item = StockItem.objects.get(pk=self.kwargs['pk'])
|
||||
return StockForms.TestReportFormatForm(stock_item)
|
||||
form = StockForms.TestReportFormatForm(stock_item)
|
||||
|
||||
return form
|
||||
|
||||
def get_initial(self):
|
||||
|
||||
initials = super().get_initial()
|
||||
|
||||
form = self.get_form()
|
||||
options = form.fields['template'].queryset
|
||||
|
||||
# If only a single template is available, pre-select it
|
||||
if options.count() == 1:
|
||||
initials['template'] = options[0]
|
||||
|
||||
return initials
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
||||
@ -1320,6 +1335,7 @@ class StockItemEdit(AjaxUpdateView):
|
||||
# If the part cannot be purchased, hide the supplier_part field
|
||||
if not item.part.purchaseable:
|
||||
form.fields['supplier_part'].widget = HiddenInput()
|
||||
form.fields['purchase_price'].widget = HiddenInput()
|
||||
else:
|
||||
query = form.fields['supplier_part'].queryset
|
||||
query = query.filter(part=item.part.id)
|
||||
@ -1622,6 +1638,9 @@ class StockItemCreate(AjaxCreateView):
|
||||
|
||||
form.rebuild_layout()
|
||||
|
||||
if not part.purchaseable:
|
||||
form.fields['purchase_price'].widget = HiddenInput()
|
||||
|
||||
# Hide the 'part' field (as a valid part is selected)
|
||||
# form.fields['part'].widget = HiddenInput()
|
||||
|
||||
|
Reference in New Issue
Block a user