feat(inventory): edit items in inventory grid
- Added 'Editar' button in inventory rows. - Reused create modal as create/edit with pre-filled data. - Added fields: unit, max_stock, tax_rate, description, is_active. - Added /inventory/categories/all endpoint for flat category selector. - Price/cost inputs are disabled for users without config.edit_prices.
This commit is contained in:
@@ -2271,6 +2271,22 @@ def list_inventory_subcategories(category_id):
|
||||
conn.close()
|
||||
|
||||
|
||||
@inventory_bp.route('/categories/all', methods=['GET'])
|
||||
@require_auth()
|
||||
def list_all_inventory_categories():
|
||||
"""Return all active categories (flat, with parent_id) for selectors."""
|
||||
conn = get_tenant_conn(g.tenant_id)
|
||||
try:
|
||||
cur = conn.cursor()
|
||||
cur.execute(
|
||||
"SELECT id, name, parent_id FROM categories WHERE is_active = true ORDER BY name"
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
return jsonify({'categories': [{'id': r[0], 'name': r[1], 'parent_id': r[2]} for r in rows]})
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
# ─── Global Tier Discounts ───────────────────────
|
||||
|
||||
@inventory_bp.route('/tier-discounts', methods=['GET'])
|
||||
|
||||
Reference in New Issue
Block a user