2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 04:25:42 +00:00

Merge branch 'master' of github.com:inventree/InvenTree into multi_part_forms

This commit is contained in:
eeintech
2021-05-11 10:22:34 -04:00
166 changed files with 776 additions and 727 deletions

View File

@ -9,7 +9,7 @@ from .models import InvenTreeSetting
class SettingsAdmin(ImportExportModelAdmin):
list_display = ('key', 'value')

View File

@ -42,7 +42,7 @@ class InvenTreeSetting(models.Model):
The key of each item is the name of the value as it appears in the database.
Each global setting has the following parameters:
- name: Translatable string name of the setting (required)
- description: Translatable string description of the setting (required)
- default: Default value (optional)
@ -414,7 +414,7 @@ class InvenTreeSetting(models.Model):
# Evaluate the function (we expect it will return a list of tuples...)
return choices()
"""
return choices
@classmethod
@ -524,7 +524,7 @@ class InvenTreeSetting(models.Model):
# Enforce standard boolean representation
if setting.is_bool():
value = InvenTree.helpers.str2bool(value)
setting.value = str(value)
setting.save()
@ -666,7 +666,7 @@ class InvenTreeSetting(models.Model):
if validator == int:
return True
if type(validator) in [list, tuple]:
for v in validator:
if v == int:
@ -677,7 +677,7 @@ class InvenTreeSetting(models.Model):
def as_int(self):
"""
Return the value of this setting converted to a boolean value.
If an error occurs, return the default value
"""
@ -687,7 +687,7 @@ class InvenTreeSetting(models.Model):
value = self.default_value()
return value
class PriceBreak(models.Model):
"""

View File

@ -19,7 +19,7 @@ def currency_code_default():
if code not in CURRENCIES:
code = 'USD'
return code

View File

@ -117,7 +117,7 @@ class SettingsViewTest(TestCase):
"""
Test for binary value
"""
setting = InvenTreeSetting.get_setting_object('PART_COMPONENT')
self.assertTrue(setting.as_bool())

View File

@ -19,7 +19,7 @@ class SettingsTest(TestCase):
def setUp(self):
user = get_user_model()
self.user = user.objects.create_user('username', 'user@email.com', 'password')
self.user.is_staff = True
self.user.save()

View File

@ -55,7 +55,7 @@ class SettingEdit(AjaxUpdateView):
"""
form = super().get_form()
setting = self.get_object()
choices = setting.choices()