mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Change POLineItem quantity to a rounding decimal field
This commit is contained in:
parent
4c96b34c7c
commit
570010b99c
@ -11,6 +11,7 @@ from django.utils.translation import ugettext as _
|
|||||||
from mptt.fields import TreeNodeChoiceField
|
from mptt.fields import TreeNodeChoiceField
|
||||||
|
|
||||||
from InvenTree.forms import HelperForm
|
from InvenTree.forms import HelperForm
|
||||||
|
from InvenTree.fields import RoundingDecimalFormField
|
||||||
|
|
||||||
from stock.models import StockLocation
|
from stock.models import StockLocation
|
||||||
from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderAttachment
|
from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderAttachment
|
||||||
@ -88,6 +89,8 @@ class EditPurchaseOrderAttachmentForm(HelperForm):
|
|||||||
class EditPurchaseOrderLineItemForm(HelperForm):
|
class EditPurchaseOrderLineItemForm(HelperForm):
|
||||||
""" Form for editing a PurchaseOrderLineItem object """
|
""" Form for editing a PurchaseOrderLineItem object """
|
||||||
|
|
||||||
|
quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PurchaseOrderLineItem
|
model = PurchaseOrderLineItem
|
||||||
fields = [
|
fields = [
|
||||||
|
20
InvenTree/order/migrations/0017_auto_20200331_1000.py
Normal file
20
InvenTree/order/migrations/0017_auto_20200331_1000.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 2.2.10 on 2020-03-31 10:00
|
||||||
|
|
||||||
|
import InvenTree.fields
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('order', '0016_purchaseorderattachment'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='purchaseorderlineitem',
|
||||||
|
name='quantity',
|
||||||
|
field=InvenTree.fields.RoundingDecimalField(decimal_places=5, default=1, help_text='Item quantity', max_digits=15, validators=[django.core.validators.MinValueValidator(0)]),
|
||||||
|
),
|
||||||
|
]
|
@ -20,6 +20,7 @@ from datetime import datetime
|
|||||||
from stock.models import StockItem
|
from stock.models import StockItem
|
||||||
from company.models import Company, SupplierPart
|
from company.models import Company, SupplierPart
|
||||||
|
|
||||||
|
from InvenTree.fields import RoundingDecimalField
|
||||||
from InvenTree.helpers import decimal2string
|
from InvenTree.helpers import decimal2string
|
||||||
from InvenTree.status_codes import OrderStatus
|
from InvenTree.status_codes import OrderStatus
|
||||||
from InvenTree.models import InvenTreeAttachment
|
from InvenTree.models import InvenTreeAttachment
|
||||||
@ -264,7 +265,7 @@ class OrderLineItem(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
quantity = models.DecimalField(max_digits=15, decimal_places=5, validators=[MinValueValidator(0)], default=1, help_text=_('Item quantity'))
|
quantity = RoundingDecimalField(max_digits=15, decimal_places=5, validators=[MinValueValidator(0)], default=1, help_text=_('Item quantity'))
|
||||||
|
|
||||||
reference = models.CharField(max_length=100, blank=True, help_text=_('Line item reference'))
|
reference = models.CharField(max_length=100, blank=True, help_text=_('Line item reference'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user