From 80d05a3ba16c09e356a699ab1b1db837f785d313 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 24 May 2021 12:53:13 +0300 Subject: Added currency --- servo/forms/product.py | 9 +++++++++ servo/migrations/0007_auto_20210524_0921.py | 23 +++++++++++++++++++++++ servo/models/product.py | 10 ++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 servo/migrations/0007_auto_20210524_0921.py diff --git a/servo/forms/product.py b/servo/forms/product.py index 7e0f52e..5fe3c7c 100644 --- a/servo/forms/product.py +++ b/servo/forms/product.py @@ -45,6 +45,15 @@ class ProductUploadForm(forms.Form): class PartsImportForm(forms.Form): partsdb = forms.FileField(label=_("Parts database file")) + currency = forms.ChoiceField( + required=True, + label=_("Currency"), + choices=( + ('EUR', 'EUR'), + ('USD', 'USD'), + ('PLN', 'PLN'), + ) + ) import_vintage = forms.BooleanField( initial=True, required=False, diff --git a/servo/migrations/0007_auto_20210524_0921.py b/servo/migrations/0007_auto_20210524_0921.py new file mode 100644 index 0000000..f518f6a --- /dev/null +++ b/servo/migrations/0007_auto_20210524_0921.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.2 on 2021-05-24 07:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('servo', '0006_auto_20210519_1925'), + ] + + operations = [ + migrations.AddField( + model_name='product', + name='currency', + field=models.CharField(default='', editable=False, max_length=3), + ), + migrations.AlterField( + model_name='note', + name='type', + field=models.IntegerField(blank=True, choices=[(0, "Technician's Note"), (5, "Customer's Note"), (1, 'Customer Reported Issue'), (4, 'Technician Verified Issue'), (3, 'Diagnosis'), (2, 'Escalation')], default=0, verbose_name='Type'), + ), + ] diff --git a/servo/models/product.py b/servo/models/product.py index 83bef0e..379df9d 100644 --- a/servo/models/product.py +++ b/servo/models/product.py @@ -2,14 +2,14 @@ import re from os.path import basename +from decimal import Decimal, ROUND_CEILING from django.db import models from django.db import connection +from django.urls import reverse from django.conf import settings from django.core.files import File from django.core.cache import cache -from decimal import Decimal, ROUND_CEILING -from django.urls import reverse from django.contrib.contenttypes.fields import GenericRelation @@ -108,6 +108,12 @@ class AbstractBaseProduct(models.Model): verbose_name=_("VAT %") ) + currency = models.CharField( + max_length=3, + default='', + editable=False, + ) + fixed_price = models.BooleanField( default=False, help_text=_("Don't update price when recalculating prices or importing parts") -- cgit v1.2.3