mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 05:26:45 +00:00
Merge pull request #2556 from eeintech/po_qty_decimal_fix
Allow decimal for quantity received on PO
This commit is contained in:
commit
dc84b41c90
@ -27,6 +27,7 @@ from stock import models as stock_models
|
|||||||
from company.models import Company, SupplierPart
|
from company.models import Company, SupplierPart
|
||||||
from plugin.events import trigger_event
|
from plugin.events import trigger_event
|
||||||
|
|
||||||
|
import InvenTree.helpers
|
||||||
from InvenTree.fields import InvenTreeModelMoneyField, RoundingDecimalField
|
from InvenTree.fields import InvenTreeModelMoneyField, RoundingDecimalField
|
||||||
from InvenTree.helpers import decimal2string, increment, getSetting
|
from InvenTree.helpers import decimal2string, increment, getSetting
|
||||||
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus, StockStatus, StockHistoryCode
|
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus, StockStatus, StockHistoryCode
|
||||||
@ -414,16 +415,12 @@ class PurchaseOrder(Order):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not (quantity % 1 == 0):
|
|
||||||
raise ValidationError({
|
|
||||||
"quantity": _("Quantity must be an integer")
|
|
||||||
})
|
|
||||||
if quantity < 0:
|
if quantity < 0:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
"quantity": _("Quantity must be a positive number")
|
"quantity": _("Quantity must be a positive number")
|
||||||
})
|
})
|
||||||
quantity = int(quantity)
|
quantity = InvenTree.helpers.clean_decimal(quantity)
|
||||||
except (ValueError, TypeError):
|
except TypeError:
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
"quantity": _("Invalid quantity provided")
|
"quantity": _("Invalid quantity provided")
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user