"""Account Payment Term Template model.""" from abacus_common_logic.models.base import CRUDMixin, db class AccountPaymentTermTemplate(db.Model, CRUDMixin): """Account Payment Term Template model.""" __tablename__ = 'account_payment_term_template' account_payment_term_template_id = db.Column(db.Integer, primary_key=True) template_name = db.Column(db.String(180), nullable=False) currency_code = db.Column(db.String(3), nullable=False) payment_terms = db.Column(db.JSON, nullable=False) @classmethod def get_by_currency_code(cls, currency_code: str = None) -> object: """Get payment term template by currency_code. Args: currency_code: An alpha-3 ISO currency code Returns: A payment term template record for a specified currency code """ return cls.query.filter(cls.currency_code == currency_code).first()