From 32d09d2d37f1ae405d7892b4b8bc8da2963d1aa1 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 3 Sep 2019 09:10:36 +1000 Subject: [PATCH] Add default value for currency --- .../migrations/0003_auto_20190902_2310.py | 19 +++++++++++++++++++ InvenTree/common/models.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 InvenTree/common/migrations/0003_auto_20190902_2310.py diff --git a/InvenTree/common/migrations/0003_auto_20190902_2310.py b/InvenTree/common/migrations/0003_auto_20190902_2310.py new file mode 100644 index 0000000000..7bfdefa8c4 --- /dev/null +++ b/InvenTree/common/migrations/0003_auto_20190902_2310.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.4 on 2019-09-02 23:10 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('common', '0002_auto_20190902_2304'), + ] + + operations = [ + migrations.AlterField( + model_name='currency', + name='value', + field=models.DecimalField(decimal_places=5, default=1.0, help_text='Currency Value', max_digits=10, validators=[django.core.validators.MinValueValidator(1e-05), django.core.validators.MaxValueValidator(100000)]), + ), + ] diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 43bc41db34..de3b9bab2c 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -33,7 +33,7 @@ class Currency(models.Model): description = models.CharField(max_length=100, blank=False, help_text=_('Currency Description')) - value = models.DecimalField(max_digits=10, decimal_places=5, validators=[MinValueValidator(0.00001), MaxValueValidator(100000)], help_text=_('Currency Value')) + value = models.DecimalField(default=1.0, max_digits=10, decimal_places=5, validators=[MinValueValidator(0.00001), MaxValueValidator(100000)], help_text=_('Currency Value')) base = models.BooleanField(default=False, help_text=_('Use this currency as the base currency'))