feat: complete product actions & fix sales returns#5
Open
coder-contrib-bot wants to merge 6 commits into
Open
Conversation
- Add subquery to aggregate returned quantities per invoice item - Add SalesReturnCreate/Response schemas for return flow - Add sales return repository methods - Implement process_return in SalesService with inventory/ledger integration - Add record_return to InventoryService - Add record_sales_return to LedgerService - Add fix for mixed invoice type constraint Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…sales Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Adjust Stock (IN/OUT with warehouse selection) - Transfer Stock between warehouses - Update Price with live margin preview - View Analytics with AI demand forecast Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Product Screen Actions: Implement all button actions in product detail drawer:
Sales Returns Backend: Add
returned_quantitytracking per invoice item via subquery aggregation onsales_return_items. Full return flow with inventory restoration, cash refund, and ledger entries.Sales Frontend: Add
InvoiceItemModel.returnedQuantityandreturnableQuantitygetter. Sales repository updated with return and items endpoints.Database: Add migration for
mixedinvoice type constraint.Files Changed
Backend
backend/app/routers/sales.py— returned_quantity subquery in items endpointbackend/app/schemas/sales.py— SalesReturnCreate/Response schemasbackend/app/repositories/sales_repo.py— return CRUD methodsbackend/app/services/sales_service.py— process_return with full accountingbackend/app/services/inventory_service.py— record_return methodbackend/app/services/ledger_service.py— record_sales_return entriesdatabase/fix_mixed_invoice_type.sql— constraint migrationFrontend
frontend/lib/features/products/data/products_repository.dart— adjustStock methodfrontend/lib/features/products/presentation/product_detail_drawer.dart— all action implementationsfrontend/lib/features/products/presentation/products_page.dart— low stock alertsfrontend/lib/features/sales/data/sales_repository.dart— returnedQuantity, returns APINote
The
sale_detail_drawer.dartchanges (didUpdateWidget refresh, operations history in print) are implemented locally but exceeded the push size limit. Those changes include:didUpdateWidgetAuthor
🤖 Generated with Claude Code