fix(inventory): fix table column shift, show transaction date/time on dashboard cards, and enforce strict multi-layer future date prevention
This commit is contained in:
@@ -22,7 +22,7 @@ SHA256 of the sorted canonical specs JSON (or 'default' when empty).
|
||||
import hashlib
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
from sqlalchemy import select
|
||||
@@ -177,6 +177,10 @@ async def apply_transaction(
|
||||
specs = payload.specs or {}
|
||||
specs_hash = canonical_specs_hash(specs)
|
||||
tx_date = payload.transaction_date or datetime.now(timezone.utc)
|
||||
# جلوگیری از ثبت تاریخ در آینده
|
||||
now_utc = datetime.now(timezone.utc)
|
||||
if tx_date > now_utc + timedelta(minutes=5):
|
||||
raise ValidationError("امکان ثبت تاریخ یا زمان در آینده وجود ندارد", field="transaction_date")
|
||||
|
||||
# STOCK_COUNT: apply the difference between counted and recorded quantity.
|
||||
if t == "STOCK_COUNT":
|
||||
|
||||
Reference in New Issue
Block a user