Implements Stock Ledger Entry (SLE) operations for ERPClaw, including validation, insertion, reversal, balance calculation, and GL generation. Supports FIFO and moving-average valuation.
# Source: https://github.com/LeoYeAI/openclaw-master-skills | License: MIT | Copyright 2026 MyClaw.ai (LeoYeAI) # Provided via justclaw.it.com; keep this notice with the code. """Stock Ledger Entry (SLE) engine for ERPClaw. All stock_ledger_entry writes go through this module. This is the ONLY code that writes to the stock_ledger_entry table. Critical design invariant. Key functions: - validate_stock_entries(): Validate SLE entries before insertion - insert_sle_entries(): Validate + insert + compute running balance - reverse_sle_entries(): Cancel by creating negative-qty mirror entries - get_stock_balance(): Current qty & value for item/warehouse - get_valuation_rate(): Current moving-average or FIFO valuation rate - create_perpetual_inventory_gl(): Generate GL entries for stock movement ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key