9e638a1ee806ba611f52a10d96a1bf984fa54e69
Steps to reproduce the bug:
- Enable product packing in inventory settings
- Create a storable product “P1”
- Update the qty with 3 package:
- Pack 1: Qty 10
- Pack 2: Qty 10
- Pack 3: Qty 20
- Product category: Force Removal Strategy: Least Packages
- Create a SO with 20 units of P1:
- Confirm → the pack 3 will be selected
- Validate the delivery
- Create another SO with 10 units of P1
- Confirm → the pack 1 will be selected
- Validate the delivery
- Create a second SO with 10 units of P1
- Confirm
Problem:
A traceback will be triggered:
return len(node.taken_packages) + node.count_remaining / qty_by_package[node.next_index][1] ZeroDivisionError: float division by zero
the issue is related to modifying the “qty_by_package” while iterating
through it. When we use “del” to remove an element, it shortens the list
in real-time. So When we remove an element, the indices of subsequent
elements get shifted, causing a skip of an element. By this why the last
element isn't iterated through correctly.
In the beginning, we have this:
[(6, 15.0), (5, 10.0), (4, 0.0), (7, 0.0)]
after iteration
[(6, 15.0), (5, 10.0), (7, 0.0)]
instead of having this
[(6, 15.0), (5, 10.0)]
Opw-3570784
closes odoo/odoo#139994
X-original-commit: cdd785981b2e7425cafbe4093ece6fdeae40c6ac
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%