1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

[invoices] Quantities can be non-integers

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
2021-03-13 12:35:28 +01:00
parent 116451603c
commit 5a7a219ba8
5 changed files with 95 additions and 3 deletions

View File

@ -5,6 +5,7 @@ from datetime import date
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.db import models, transaction
from django.db.models import Q
from django.template.loader import render_to_string
@ -131,12 +132,13 @@ class Product(models.Model):
verbose_name=_("Designation"),
)
quantity = models.PositiveIntegerField(
verbose_name=_("Quantity")
quantity = models.FloatField(
verbose_name=_("Quantity"),
validators=[MinValueValidator(0)],
)
amount = models.IntegerField(
verbose_name=_("Unit price")
verbose_name=_("Unit price"),
)
@property