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
+19 -2
View File
@@ -1,4 +1,4 @@
from sqlalchemy import Column, Integer, String, Date, DateTime, Text, Enum
from sqlalchemy import Column, Integer, String, Date, DateTime, Text, Numeric
from sqlalchemy.sql import func
from app.database.database import Base
from datetime import datetime
@@ -12,7 +12,7 @@ class Project(Base):
name = Column(String, index=True, nullable=False)
contract_number = Column(String)
contract_date = Column(Date)
customer = Column(String)
customer = Column(String) # domain: customer_name
currency = Column(String, default="RUB")
start_date = Column(Date)
end_date = Column(Date)
@@ -20,10 +20,27 @@ class Project(Base):
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
# Official document requisites (DOC-B10)
investor_name = Column(String)
customer_name = Column(String) # preferred domain name for customer
contractor_name = Column(String)
construction_name = Column(String)
object_name = Column(String)
contract_amount = Column(Numeric(18, 2))
contractor_signer_name = Column(String)
contractor_signer_position = Column(String)
customer_signer_name = Column(String)
customer_signer_position = Column(String)
# Relationships
boq_documents = relationship("BoqDocument", back_populates="project")
systems = relationship("System", back_populates="project")
agreements = relationship("Agreement", back_populates="project", cascade="all, delete-orphan")
@property
def effective_customer_name(self) -> str:
"""Return customer_name if set, else fall back to legacy customer field."""
return self.customer_name or self.customer or ""
def __repr__(self):
return f"<Project(id={self.id}, name='{self.name}')>"