How to use the piecash.Account.guid.in_ function in piecash

To help you get started, we’ve selected a few piecash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MisterY / gnucash-portfolio / app / controllers / distributions_controller.py View on Github external
def __load_income_in_period_query(
        book: Book, account_ids: List[hex], in_model) -> List[Split]:
    """ Load all data by using the query directly """

    date_from = in_model.date_from
    date_to = in_model.date_to
    log(DEBUG, "fetching data for period %s - %s", date_from, date_to)

    query = (book.query(Split)
             .join(Transaction)
             .join(Account)
             .filter(Transaction.post_date >= date_from, Transaction.post_date <= date_to,
                     Account.guid.in_(account_ids))
             .order_by(Transaction.post_date)
            )

    if in_model.currency:
        query = (query
                 .join(Commodity)
                 .filter(Commodity.mnemonic == in_model.currency)
                )

    return query.all()
github MisterY / gnucash-portfolio / gnucash_portfolio / accounts.py View on Github external
def get_list(self, ids: List[str]) -> List[Account]:
        """ Loads accounts by the ids passed as an argument """
        query = (
            self.query
            .filter(Account.guid.in_(ids))
        )
        return query.all()