As agreed in the review, Hesabix no longer rebuilds the rows left after a
return. The return document's own lines go to /api/invoice/send with
ins=4 and returnRows "returned"; Motamed ASA (API v2 1.0.0.71) matches each
line to the registered reference rows by goods id, unit price, VAT rate and
discount per unit, refuses an ambiguous line instead of guessing
(INVOICE_RETURN_ROW_AMBIGUOUS), spreads a line over identical rows, and
builds the remaining rows with every tax field (vop, ssrv, ...) of the
reference.
- irtaxid is the sale's tax id as Motamed ASA gave it; ASA finds the
chain's latest invoice itself, so no inquiry is needed first.
- buyer fields are left out of a return (outside the pattern; they come
from the reference).
- a return already rejected at ASA is not rewritten through editInvoice.
Removes build_motamed_asa_return_invoice and _remaining_row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Monolithic modular backend (DDD-lite) using FastAPI + SQLAlchemy + MySQL.
Quickstart (Dev)
Create and fill .env from .env.example.
Install dependencies:
pip install -e .[dev]
Run app:
uvicorn app.main:app --reload
Health endpoint: GET /api/v1/health.
Configuration
See app/core/settings.py and .env.example.
چت CRM و WebSocket: اگر Redis برای API خاموش است، برای رویدادهای زندهٔ چت باید تک worker یا sticky وبسوکت باشد؛ جزییات: docs/CRM_CHAT_WEBSOCKET_DEPLOYMENT.md.