mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 03:26:45 +00:00
* Fix logic for adding items to SalesOrder * Same thing for purchase orders * Update serializers.py Revert typo fix - Otherwise, we need to do an API bump and the PR can't be back-ported! (cherry picked from commit bc9dbf7df4666935ac5699c22daf04122bd78445) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
ee87cd7b23
commit
8a2fce9c36
@ -11,7 +11,11 @@ import order.models
|
||||
import plugin.base.barcodes.helper
|
||||
import stock.models
|
||||
from InvenTree.serializers import UserSerializer
|
||||
from order.status_codes import PurchaseOrderStatus, SalesOrderStatus
|
||||
from order.status_codes import (
|
||||
PurchaseOrderStatus,
|
||||
PurchaseOrderStatusGroups,
|
||||
SalesOrderStatusGroups,
|
||||
)
|
||||
|
||||
|
||||
class BarcodeScanResultSerializer(serializers.ModelSerializer):
|
||||
@ -135,8 +139,8 @@ class BarcodePOAllocateSerializer(BarcodeSerializer):
|
||||
|
||||
def validate_purchase_order(self, order: order.models.PurchaseOrder):
|
||||
"""Validate the provided order."""
|
||||
if order.status != PurchaseOrderStatus.PENDING.value:
|
||||
raise ValidationError(_('Purchase order is not pending'))
|
||||
if order.status not in PurchaseOrderStatusGroups.OPEN:
|
||||
raise ValidationError(_('Purchase order is not open'))
|
||||
|
||||
return order
|
||||
|
||||
@ -213,8 +217,8 @@ class BarcodeSOAllocateSerializer(BarcodeSerializer):
|
||||
|
||||
def validate_sales_order(self, order: order.models.SalesOrder):
|
||||
"""Validate the provided order."""
|
||||
if order and order.status != SalesOrderStatus.PENDING.value:
|
||||
raise ValidationError(_('Sales order is not pending'))
|
||||
if order and order.status not in SalesOrderStatusGroups.OPEN:
|
||||
raise ValidationError(_('Sales order is not open'))
|
||||
|
||||
return order
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user