feat: add project requisites and agreement cancellation

This commit is contained in:
Александр Арсентьев
2026-09-30 16:42:02 +03:00
parent 3c8bbe8b4b
commit a2a01e24e6
21 changed files with 1828 additions and 12 deletions
+22 -1
View File
@@ -28,6 +28,17 @@ class KS2ExportHeader:
period_to: date | None
comment: str
status: str
# Official requisites (DOC-B10)
investor_name: str = ""
customer_name: str = ""
contractor_name: str = ""
construction_name: str = ""
object_name: str = ""
contract_amount: str = ""
contractor_signer_name: str = ""
contractor_signer_position: str = ""
customer_signer_name: str = ""
customer_signer_position: str = ""
@dataclass(frozen=True)
@@ -60,7 +71,7 @@ def build_ks2_export_dto(db, ks2_document) -> KS2ExportDocument:
header = KS2ExportHeader(
project_name=project.name if project else "",
customer=project.customer if project and project.customer else "",
customer=project.effective_customer_name if project else "",
contract_number=project.contract_number if project and project.contract_number else "",
contract_date=project.contract_date if project else None,
currency=project.currency if project and project.currency else "",
@@ -70,5 +81,15 @@ def build_ks2_export_dto(db, ks2_document) -> KS2ExportDocument:
period_to=ks2_document.reporting_period_to,
comment=ks2_document.comment or "",
status=ks2_document.status or "",
investor_name=project.investor_name if project and project.investor_name else "",
customer_name=project.effective_customer_name if project else "",
contractor_name=project.contractor_name if project and project.contractor_name else "",
construction_name=project.construction_name if project and project.construction_name else "",
object_name=project.object_name if project and project.object_name else "",
contract_amount=str(project.contract_amount) if project and project.contract_amount is not None else "",
contractor_signer_name=project.contractor_signer_name if project and project.contractor_signer_name else "",
contractor_signer_position=project.contractor_signer_position if project and project.contractor_signer_position else "",
customer_signer_name=project.customer_signer_name if project and project.customer_signer_name else "",
customer_signer_position=project.customer_signer_position if project and project.customer_signer_position else "",
)
return KS2ExportDocument(header=header, items=items, total=total)
+22 -1
View File
@@ -27,6 +27,17 @@ class KS3ExportHeader:
period_to: date | None
comment: str
status: str
# Official requisites (DOC-B10)
investor_name: str = ""
customer_name: str = ""
contractor_name: str = ""
construction_name: str = ""
object_name: str = ""
contract_amount: str = ""
contractor_signer_name: str = ""
contractor_signer_position: str = ""
customer_signer_name: str = ""
customer_signer_position: str = ""
@dataclass(frozen=True)
@@ -60,7 +71,7 @@ def build_ks3_export_dto(db, ks3_document) -> KS3ExportDocument:
header = KS3ExportHeader(
project_name=project.name if project else "",
customer=project.customer if project and project.customer else "",
customer=project.effective_customer_name if project else "",
contract_number=project.contract_number if project and project.contract_number else "",
contract_date=project.contract_date if project else None,
currency=project.currency if project and project.currency else "",
@@ -70,5 +81,15 @@ def build_ks3_export_dto(db, ks3_document) -> KS3ExportDocument:
period_to=ks3_document.reporting_period_to,
comment=ks3_document.comment or "",
status=ks3_document.status or "",
investor_name=project.investor_name if project and project.investor_name else "",
customer_name=project.effective_customer_name if project else "",
contractor_name=project.contractor_name if project and project.contractor_name else "",
construction_name=project.construction_name if project and project.construction_name else "",
object_name=project.object_name if project and project.object_name else "",
contract_amount=str(project.contract_amount) if project and project.contract_amount is not None else "",
contractor_signer_name=project.contractor_signer_name if project and project.contractor_signer_name else "",
contractor_signer_position=project.contractor_signer_position if project and project.contractor_signer_position else "",
customer_signer_name=project.customer_signer_name if project and project.customer_signer_name else "",
customer_signer_position=project.customer_signer_position if project and project.customer_signer_position else "",
)
return KS3ExportDocument(header=header, items=items, total=total)
+10
View File
@@ -375,6 +375,16 @@ def serialize_project(graph: dict[str, Any]) -> dict[str, list | dict]:
"status": project.status,
"created_at": _iso(project.created_at),
"updated_at": _iso(project.updated_at),
"investor_name": project.investor_name,
"customer_name": project.customer_name or project.customer,
"contractor_name": project.contractor_name,
"construction_name": project.construction_name,
"object_name": project.object_name,
"contract_amount": _dec(project.contract_amount),
"contractor_signer_name": project.contractor_signer_name,
"contractor_signer_position": project.contractor_signer_position,
"customer_signer_name": project.customer_signer_name,
"customer_signer_position": project.customer_signer_position,
}
def record(kind: str, obj: Any, fields: dict[str, Any]) -> dict[str, Any]:
+10
View File
@@ -489,6 +489,16 @@ def _import_entities(db: Session, payload: dict[str, Any]) -> Project:
start_date=_parse_date(src.get("start_date"), "start_date"),
end_date=_parse_date(src.get("end_date"), "end_date"),
status=src.get("status") or "active",
investor_name=src.get("investor_name"),
customer_name=src.get("customer_name") or src.get("customer"),
contractor_name=src.get("contractor_name"),
construction_name=src.get("construction_name"),
object_name=src.get("object_name"),
contract_amount=_parse_decimal(src.get("contract_amount"), "contract_amount"),
contractor_signer_name=src.get("contractor_signer_name"),
contractor_signer_position=src.get("contractor_signer_position"),
customer_signer_name=src.get("customer_signer_name"),
customer_signer_position=src.get("customer_signer_position"),
)
db.add(project)
db.flush()