Feature #6847
openworking on vendorinvoice issues and stockbatch based cosuming the items seperation.
Subtasks
Related issues
Updated by Teja Sriram Sangani 17 days ago
- Status changed from New to In Progress
1. Stock batch tracking system
Problem: Batches were created but not used in sales
Solution: Implemented FIFO batch consumption and added batch tracking to sales
2. Stock batch not being consumed
Problem: Batches weren't decrementing on sales
Root causes:
Wrong module path (../ instead of ../../)
ProductId format mismatch in queries
Batch records not being saved to sales
Solution: Fixed all issues and improved batch update logic
3. Fallback for missing batches
Problem: Sales would fail if no batches existed
Solution: Added graceful fallback to direct quantity decrement
4. Global stock batch utility
Problem: Code duplication across sale functions
Solution: Created reusable processProductWithStockBatch() function
5. Product quantity not increasing
Problem: Vendor invoice creation wasn't increasing product quantity
Root cause: Using $set with calculated values (failed on null/undefined)
Solution: Changed to $inc operator for reliable increment
6. Product quotation integration
Problem: Quotation approvals didn't use stock batch tracking
Solution: Updated to use SaleService.createSale() which includes batch processing
7. Missing stockBatch in Zelle sales
Problem: zelleSaleNew wasn't saving batch records
Solution: Added stockBatch field to product objects