@@ 795-806 (lines=12) @@ | ||
792 | def __init__(self, event, amount, reimbursee): |
|
793 | Transaction.__init__(self, event, None, None, reimbursee, None, amount) |
|
794 | ||
795 | ||
796 | ################################################################################ |
|
797 | ## SUB TRANSACTIONS |
|
798 | ################################################################################ |
|
799 | ||
800 | class SubTransaction(Base): |
|
801 | __tablename__ = "subtransactions" |
|
802 | ||
803 | id = Column(Integer, primary_key=True, nullable=False) |
|
804 | transaction_id = Column(Integer, ForeignKey("transactions.id"), nullable=False) |
|
805 | amount = Column(Numeric, nullable=False) |
|
806 | type = Column(Enum("purchaselineitem", "restocklineitem", |
|
807 | "restocklinebox", "inventorylineitem", |
|
808 | name="subtransaction_type"), nullable=False) |
|
809 | item_id = Column(Integer, ForeignKey("items.id"), nullable=True) |
|
@@ 782-793 (lines=12) @@ | ||
779 | Transaction.__init__(self, event, None, chezbetty_v, donator, chezbetty_c, amount) |
|
780 | ||
781 | ||
782 | class Withdrawal(Transaction): |
|
783 | __mapper_args__ = {'polymorphic_identity': 'withdrawal'} |
|
784 | def __init__(self, event, amount, reimbursee): |
|
785 | chezbetty_v = account.get_virt_account("chezbetty") |
|
786 | chezbetty_c = account.get_cash_account("chezbetty") |
|
787 | Transaction.__init__(self, event, chezbetty_v, None, chezbetty_c, reimbursee, amount) |
|
788 | ||
789 | ||
790 | class Reimbursement(Transaction): |
|
791 | __mapper_args__ = {'polymorphic_identity': 'reimbursement'} |
|
792 | def __init__(self, event, amount, reimbursee): |
|
793 | Transaction.__init__(self, event, None, None, reimbursee, None, amount) |
|
794 | ||
795 | ||
796 | ################################################################################ |
|
@@ 769-780 (lines=12) @@ | ||
766 | ||
767 | ||
768 | class Found(Transaction): |
|
769 | __mapper_args__ = {'polymorphic_identity': 'found'} |
|
770 | def __init__(self, event, dest_acct, amount): |
|
771 | Transaction.__init__(self, event, None, None, None, dest_acct, amount) |
|
772 | ||
773 | ||
774 | class Donation(Transaction): |
|
775 | __mapper_args__ = {'polymorphic_identity': 'donation'} |
|
776 | def __init__(self, event, amount, donator=None): |
|
777 | chezbetty_v = account.get_virt_account("chezbetty") |
|
778 | chezbetty_c = account.get_cash_account("chezbetty") |
|
779 | Transaction.__init__(self, event, None, chezbetty_v, donator, chezbetty_c, amount) |
|
780 | ||
781 | ||
782 | class Withdrawal(Transaction): |
|
783 | __mapper_args__ = {'polymorphic_identity': 'withdrawal'} |
|
@@ 481-492 (lines=12) @@ | ||
478 | .filter(or_( |
|
479 | Transaction.to_account_cash_id == account_id, |
|
480 | Transaction.fr_account_cash_id == account_id))\ |
|
481 | .filter(event.Event.deleted==False)\ |
|
482 | .order_by(desc(event.Event.timestamp)) |
|
483 | return q |
|
484 | event.Event.get_events_by_cashaccount = __get_events_by_cashaccount |
|
485 | ||
486 | # This is in a stupid place due to circular input problems |
|
487 | @classmethod |
|
488 | def __get_deadbeats(cls): |
|
489 | deadbeats = DBSession.query(user.User)\ |
|
490 | .filter(user.User.enabled==True)\ |
|
491 | .filter(user.User.archived==False)\ |
|
492 | .filter(user.User.balance <= -5)\ |
|
493 | .all() |
|
494 | ||
495 | # Only get users between 0 and -5 if they have been in debt for a week or |