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
    )
dataset/ETHPy150Open dimagi/commcare-hq/corehq/form_processor/backends/sql/ledger.py/_get_ledger_transaction/original