2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Add option to enable / disable stock expiry feature

- Simply hides fields in form views
This commit is contained in:
Oliver Walters
2021-01-05 08:50:07 +11:00
parent 1335c85de1
commit d0fb69e67d
5 changed files with 40 additions and 2 deletions

View File

@ -1302,6 +1302,10 @@ class StockItemEdit(AjaxUpdateView):
form = super(AjaxUpdateView, self).get_form()
# Hide the "expiry date" field if the feature is not enabled
if not common.settings.stock_expiry_enabled():
form.fields.pop('expiry_date')
item = self.get_object()
# If the part cannot be purchased, hide the supplier_part field
@ -1513,6 +1517,10 @@ class StockItemCreate(AjaxCreateView):
form = super().get_form()
# Hide the "expiry date" field if the feature is not enabled
if not common.settings.stock_expiry_enabled():
form.fields.pop('expiry_date')
part = self.get_part(form=form)
if part is not None: