Stock Lot - Grouped SUM for Computed Fields
by Muhammed Aslam https://www.linkedin.com/in/muhammed-aslam-817327106/
Odoo
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Inventory (stock)
• Discuss (mail) |
| Lines of code | 28 |
| Technical Name |
stock_lot_onhand_sum |
| License | LGPL-3 |
| Website | https://www.linkedin.com/in/muhammed-aslam-817327106/ |
| Versions | 17.0 18.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Inventory (stock)
• Discuss (mail) |
| Lines of code | 28 |
| Technical Name |
stock_lot_onhand_sum |
| License | LGPL-3 |
| Website | https://www.linkedin.com/in/muhammed-aslam-817327106/ |
| Versions | 17.0 18.0 |
Odoo Module: Stock Lot - Grouped SUM for Computed Fields
This module provides a critical fix for inventory management in Odoo by enabling the correct summation of non-stored computed fields like **'On Hand Quantity'** (product_qty) when grouping Lot/Serial Numbers by Product.
Key Functionality
- **Field Targeted:**
product_qty(On Hand Quantity). - **Method:** Overrides
stock.lot's_read_groupandread_groupmethods. - **Mechanism:** Calculates the sum of quantities in Python for each group instead of relying on inefficient SQL aggregation for computed fields.
Installation and Usage
For a full demonstration of the problem and the solution provided by this module, watch the video below:
📺 Watch Demo Video on YouTube (Click Here)
After installing the module, navigate to Inventory > Lots/Serial Numbers and group the view by **Product** to see the accurate totals, as shown in this screenshot:
Note how the totals (e.g., 99.00 and 99.00) are correctly calculated for the grouped products pro2 (2) and pro3 (2).
Please log in to comment on this module