sync_voucher_items_to_sql
Pull voucher inventory line items into SQL cache for a date range, enabling direct SQL computation of stock movement, godown-wise balances, and batch details.
Instructions
Pull voucher INVENTORY LINE ITEMS (stock item, qty, rate, amount, godown, batch — one row per item per batch allocation) for one date range into this session's SQL cache, so query_sql can compute movement analysis, godown-wise stock, or batch detail directly. This is the raw data those analyses need — Tally has no exportable 'Movement Analysis'/'Stock Ageing Analysis'/'Godown Summary' report reachable over the gateway (confirmed live against all 138 registered report names, and confirmed live that per-godown $ClosingBalance/SVGODOWNNAME scoping doesn't work either), so this connector doesn't try to replicate those as report tools — pull the line items with this, then write the aggregation as SQL. qty/amount are UNSIGNED as Tally stores them on the inventory entry; use is_deemed_positive together with voucher_type to work out inward vs outward direction. A voucher with no stock items (Payment, Journal, etc.) contributes zero rows, not an empty one. Same chunked, additive-by-date-range model and same timeout caution as sync_vouchers_to_sql — quarterly/monthly chunks for a busy company. If you switch companies (set_company), sync again — the cache doesn't track which company a row came from, so don't query across a company switch without re-syncing first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | End date in DD-MM-YYYY format | |
| from | Yes | Start date in DD-MM-YYYY format |