Add support for importing MemberEquityPayment from CORE-POS DB

SQL only, no API for now
This commit is contained in:
Lance Edgar 2023-09-07 17:49:28 -05:00
parent 35e24422a2
commit a57f29fe1a
8 changed files with 248 additions and 15 deletions

View file

@ -178,3 +178,54 @@ class CoreMember(model.Base):
return str(self.member)
CoreMember.make_proxy(model.Member, '_corepos', 'corepos_account_id')
class CoreMemberEquityPayment(model.Base):
"""
CORE-specific extensions to
:class:`~rattail:rattail.db.model.MemberEquityPayment`.
"""
__tablename__ = 'corepos_member_equity_payment'
__table_args__ = (
sa.ForeignKeyConstraint(['uuid'], ['member_equity_payment.uuid'],
name='corepos_member_equity_payment_fk_payment'),
)
__versioned__ = {}
uuid = model.uuid_column(default=None)
payment = orm.relationship(
model.MemberEquityPayment,
doc="""
Reference to the actual payment record, which this one extends.
""",
backref=orm.backref(
'_corepos',
uselist=False,
cascade='all, delete-orphan',
doc="""
Reference to the CORE-POS extension record for this payment.
"""))
corepos_card_number = sa.Column(sa.Integer(), nullable=False, doc="""
``stockpurchases.card_no`` value for this payment, within CORE-POS.
""")
corepos_transaction_number = sa.Column(sa.String(length=50), nullable=True, doc="""
``stockpurchases.trans_num`` value for this payment, within CORE-POS.
""")
corepos_transaction_id = sa.Column(sa.Integer(), nullable=True, doc="""
``stockpurchases.trans_id`` value for this payment, within CORE-POS.
""")
corepos_department_number = sa.Column(sa.Integer(), nullable=True, doc="""
``stockpurchases.dept`` value for this payment, within CORE-POS.
""")
def __str__(self):
return str(self.payment)
CoreMemberEquityPayment.make_proxy(model.MemberEquityPayment, '_corepos', 'corepos_card_number')
CoreMemberEquityPayment.make_proxy(model.MemberEquityPayment, '_corepos', 'corepos_transaction_number')
CoreMemberEquityPayment.make_proxy(model.MemberEquityPayment, '_corepos', 'corepos_transaction_id')
CoreMemberEquityPayment.make_proxy(model.MemberEquityPayment, '_corepos', 'corepos_department_number')