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:
@ -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:
|
||||
|
Reference in New Issue
Block a user