54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
import uuid
|
|
|
|
from barker.models.reporting_level import ReportingLevel
|
|
from barker.models.voucher_type import VoucherType
|
|
from sqlalchemy import Boolean, Enum, Integer, Unicode
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from sqlalchemy.sql import expression
|
|
|
|
from ..db.base_class import reg
|
|
|
|
|
|
@reg.mapped_as_dataclass(unsafe_hash=True)
|
|
class SettleOption:
|
|
__tablename__ = "settle_options"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column("id", Integer, primary_key=True)
|
|
name: Mapped[str] = mapped_column("name", Unicode(255), unique=True, nullable=False)
|
|
voucher_type: Mapped[VoucherType] = mapped_column("voucher_type", Enum(VoucherType), nullable=False)
|
|
reporting_level: Mapped[ReportingLevel] = mapped_column("reporting_level", Enum(ReportingLevel), nullable=False)
|
|
has_reason: Mapped[bool] = mapped_column(
|
|
"has_reason", Boolean, nullable=False, server_default=expression.false(), insert_default=False
|
|
)
|
|
is_fixture: Mapped[bool] = mapped_column(
|
|
"is_fixture", Boolean, nullable=False, server_default=expression.false(), insert_default=False
|
|
)
|
|
|
|
def __init__(self, name=None, voucher_type=None, reporting_level=None, has_reason=None, is_fixture=None, id_=None):
|
|
self.id = id_
|
|
self.name = name
|
|
self.voucher_type = voucher_type
|
|
self.reporting_level = reporting_level
|
|
self.has_reason = has_reason
|
|
self.is_fixture = is_fixture
|
|
|
|
@classmethod
|
|
def UNSETTLED(cls):
|
|
return 1
|
|
|
|
@classmethod
|
|
def ROUND_OFF(cls):
|
|
return 7
|
|
|
|
@classmethod
|
|
def AMOUNT(cls):
|
|
return 8
|
|
|
|
@classmethod
|
|
def VOID(cls):
|
|
return 9
|
|
|
|
@classmethod
|
|
def CANCEL(cls):
|
|
return 12
|