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:
2026-10-19 23:48:42 +03:30
parent 42fb314834
commit 31300728b6
5 changed files with 203 additions and 75 deletions
+5 -1
View File
@@ -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":