Esempio n. 1
0
def _tx_new(type_, delta, updated_balance, age):
    return LedgerTransaction(
        type=type_,
        delta=delta,
        updated_balance=updated_balance,
        report_date=ago(age)
    )
Esempio n. 2
0
def _get_ledger_transaction(lazy_original_balance, stock_report_helper,
                            stock_trans, new_balance):
    return LedgerTransaction(form_id=stock_report_helper.form_id,
                             server_date=stock_report_helper.server_date,
                             report_date=stock_report_helper.timestamp,
                             type=_report_type_to_ledger_type(
                                 stock_report_helper.report_type),
                             case_id=stock_trans.case_id,
                             section_id=stock_trans.section_id,
                             entry_id=stock_trans.product_id,
                             user_defined_type=stock_trans.subaction,
                             delta=new_balance - lazy_original_balance(),
                             updated_balance=new_balance)