decision book create update
This commit is contained in:
@@ -430,48 +430,44 @@ class AccountRecords(CrudCollection):
|
||||
approving_accounting_record: Mapped[bool] = mapped_column(
|
||||
Boolean, server_default="0"
|
||||
)
|
||||
accounting_receipt_date = mapped_column(
|
||||
accounting_receipt_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, server_default="1900-01-01 00:00:00"
|
||||
)
|
||||
accounting_receipt_number = mapped_column(Integer, server_default="0")
|
||||
status_id = mapped_column(SmallInteger, server_default="0")
|
||||
accounting_receipt_number: Mapped[int] = mapped_column(Integer, server_default="0")
|
||||
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||
|
||||
approved_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
||||
import_file_name = mapped_column(String, nullable=True, comment="XLS Key")
|
||||
import_file_name: Mapped[str] = mapped_column(String, nullable=True, comment="XLS Key")
|
||||
|
||||
receive_debit: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"))
|
||||
receive_debit_uu_id = mapped_column(String, nullable=True, comment="Debit UU ID")
|
||||
receive_debit: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UU ID")
|
||||
budget_type: Mapped[int] = mapped_column(
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||
)
|
||||
budget_type_uu_id = mapped_column(
|
||||
budget_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Budget Type UU ID"
|
||||
)
|
||||
|
||||
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||
company_uu_id = mapped_column(String, nullable=True, comment="Company UU ID")
|
||||
send_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
|
||||
send_company_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Send Company UU ID"
|
||||
)
|
||||
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
|
||||
company_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Company UU ID")
|
||||
send_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
|
||||
send_company_uu_id = mapped_column(String, nullable=True, comment="Send Company UU ID" )
|
||||
|
||||
customer_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||
customer_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
|
||||
customer_uu_id = mapped_column(String, nullable=True, comment="Customer UU ID")
|
||||
send_person_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||
send_person_uu_id = mapped_column(
|
||||
String, nullable=True, comment="Send Person UU ID"
|
||||
)
|
||||
approving_accounting_person: Mapped[int] = mapped_column(ForeignKey("people.id"))
|
||||
approving_accounting_person_uu_id = mapped_column(
|
||||
send_person_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
|
||||
send_person_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Send Person UU ID")
|
||||
approving_accounting_person: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
|
||||
approving_accounting_person_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Approving Accounting Person UU ID"
|
||||
)
|
||||
# build_id: Mapped[int] = mapped_column(ForeignKey("build.id"), nullable=True)
|
||||
build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"))
|
||||
build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"), nullable=True)
|
||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Parts UU ID"
|
||||
)
|
||||
build_decision_book_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_decision_book.id")
|
||||
ForeignKey("build_decision_book.id"), nullable=True
|
||||
)
|
||||
build_decision_book_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Decision Book UU ID"
|
||||
|
||||
@@ -20,6 +20,7 @@ class FilterAttributes:
|
||||
__session__ = Base.session # The session to use in the model.
|
||||
|
||||
pre_query = None # The query to use before the filtering such as: query = cls.query.filter_by(active=True)
|
||||
total_count = None # The query to use before the filtering such as: query = cls.query.filter_by(active=True)
|
||||
filter_attr = None # The filter attributes to use in the model.
|
||||
FilterModel = ListOptions
|
||||
|
||||
@@ -130,6 +131,7 @@ class FilterAttributes:
|
||||
)
|
||||
args = cls.get_not_expired_query_arg(args)
|
||||
query = cls._query().filter(*args).with_entities(*select_args)
|
||||
cls.total_count = query.count()
|
||||
if order_by is not None:
|
||||
query = query.order_by(order_by)
|
||||
if limit:
|
||||
@@ -145,9 +147,11 @@ class FilterAttributes:
|
||||
kwargs["is_confirmed"] = True
|
||||
kwargs.pop("system", None)
|
||||
query = cls._query().filter_by(**kwargs)
|
||||
cls.total_count = query.count()
|
||||
if cls.filter_attr:
|
||||
filter_list = cls.get_filter_attributes()
|
||||
data_query = cls.add_query_to_filter(query, filter_list)
|
||||
cls.filter_attr = None
|
||||
return AlchemyResponse(query=data_query, first=False)
|
||||
return AlchemyResponse(query=query, first=False)
|
||||
|
||||
@@ -160,6 +164,7 @@ class FilterAttributes:
|
||||
kwargs["is_confirmed"] = True
|
||||
kwargs.pop("system", None)
|
||||
query = cls._query().filter_by(**kwargs)
|
||||
cls.total_count = 1
|
||||
return AlchemyResponse(query=query, first=True)
|
||||
|
||||
@classmethod
|
||||
@@ -174,9 +179,11 @@ class FilterAttributes:
|
||||
args = cls.get_not_expired_query_arg(args)
|
||||
|
||||
query = cls._query().filter(*args)
|
||||
cls.total_count = query.count()
|
||||
if cls.filter_attr:
|
||||
filter_list = cls.get_filter_attributes()
|
||||
data_query = cls.add_query_to_filter(query, filter_list)
|
||||
cls.filter_attr = None
|
||||
return AlchemyResponse(query=data_query, first=False)
|
||||
return AlchemyResponse(query=query, first=False)
|
||||
|
||||
@@ -191,6 +198,7 @@ class FilterAttributes:
|
||||
)
|
||||
args = cls.get_not_expired_query_arg(args)
|
||||
query = cls._query().filter(*args)
|
||||
cls.total_count = 1
|
||||
return AlchemyResponse(query=query, first=True)
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user