diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index 38689df26b..8c28d997f6 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -18,7 +18,7 @@ from InvenTree import version, settings import InvenTree.helpers -from common.models import InvenTreeSetting, ColorTheme +from common.models import InvenTreeSetting, ColorTheme, InvenTreeUserSetting from common.settings import currency_code_default register = template.Library() @@ -182,11 +182,12 @@ def setting_object(key, *args, **kwargs): """ Return a setting object speciifed by the given key (Or return None if the setting does not exist) + if a user-setting was requested return that """ - setting = InvenTreeSetting.get_setting_object(key) - - return setting + if 'user' in kwargs: + return InvenTreeUserSetting.get_setting_object(key, user=kwargs['user']) + return InvenTreeSetting.get_setting_object(key) @register.simple_tag() diff --git a/InvenTree/templates/InvenTree/settings/setting.html b/InvenTree/templates/InvenTree/settings/setting.html index 7376adf8d9..66f3f9f3b0 100644 --- a/InvenTree/templates/InvenTree/settings/setting.html +++ b/InvenTree/templates/InvenTree/settings/setting.html @@ -1,7 +1,12 @@ {% load inventree_extras %} {% load i18n %} -{% setting_object key as setting %} +{% if user_setting %} + {% setting_object key user=request.user as setting %} +{% else %} + {% setting_object key as setting %} +{% endif %} + {% if icon %} @@ -28,7 +33,7 @@
-
diff --git a/InvenTree/templates/InvenTree/settings/settings.html b/InvenTree/templates/InvenTree/settings/settings.html index 25ae5d24b2..03cf276594 100644 --- a/InvenTree/templates/InvenTree/settings/settings.html +++ b/InvenTree/templates/InvenTree/settings/settings.html @@ -45,9 +45,14 @@ $('table').find('.btn-edit-setting').click(function() { var setting = $(this).attr('setting'); var pk = $(this).attr('pk'); + var url = `/settings/${pk}/edit/`; + + if ($(this).attr('user')){ + url += `user/`; + } launchModalForm( - `/settings/${pk}/edit/`, + url, { reload: true, }