"""Reference SAP Profit Center Model.""" from abacus_common_logic.connectors.database import db from abacus_common_logic.models.base import CRUDMixin class ReferenceSapProfitCenter(db.Model, CRUDMixin): """Reference SAP Profit Center Model.""" __tablename__ = 'reference_sap_profit_center' reference_sap_profit_center_id = db.Column(db.Integer, primary_key=True) profit_center = db.Column(db.String(10), nullable=False) company_code = db.Column(db.String(4), nullable=False) business_group = db.Column(db.String(3), nullable=False) reference_signing_entities = db.relationship( 'ReferenceSigningEntity', back_populates='reference_sap_profit_center', cascade='all, delete-orphan', lazy='dynamic', ) @classmethod def get_default(cls): """Get default reference_sap_profit_center entry.""" return cls.query.filter(cls.business_group == 'ORC').first()