aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2021-05-24 12:53:13 +0300
committerFilipp Lepalaan <filipp@mac.com>2021-05-24 12:53:13 +0300
commit80d05a3ba16c09e356a699ab1b1db837f785d313 (patch)
tree40e74baae7ad04b46b342f978eb3c4456d98df3c
parentabfb352e0c735e1b86b78d3160693eb713adbdfc (diff)
downloadServo-80d05a3ba16c09e356a699ab1b1db837f785d313.tar.gz
Servo-80d05a3ba16c09e356a699ab1b1db837f785d313.tar.bz2
Servo-80d05a3ba16c09e356a699ab1b1db837f785d313.zip
Added currency
-rw-r--r--servo/forms/product.py9
-rw-r--r--servo/migrations/0007_auto_20210524_0921.py23
-rw-r--r--servo/models/product.py10
3 files changed, 40 insertions, 2 deletions
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")