Stock quantities of products are calculated in some cases wrong
An older issue reported by some users, that Trytons stock locations are showing
wrong quantities in some cases. Always when I tried to reproduce, it worked. Now
I investigate and found a condition when the stock quantity is calculated wrong.
Reproduce alt least in series 2.2 and tip.
Scenario
========
Setup
-----
0. create a database with at least stock module installed.
1. Create a stockable product.
2. add a new stock location name 'Storage 1' of type 'view' with parent 'Storage
Zone'
3. add a new stock location name 'Storage 1.1' of type 'storage' with parent
'Storage 1'
4. Make an inventory for location 'Storage 1.1' with product and add quantity 1.0.
5. Check expected Result: Open Product link 'Product by locations':
"Lost and Found" "-1.00" "-1.00"
"Warehouse" "1.00" "1.00"
"Storage Zone" "1.00" "1.00"
"Storage 1" "1.00" "1.00"
"Storage 1.1" "1.00" "1.00"
Condition for wrong quantities
------------------------------
6. add a new stock location name 'Storage 2' of type 'view' with parent 'Storage
Zone'
7. Check wrong result: Open Product link 'Product by locations':
"Lost and Found" "-1.00" "-1.00"
"Warehouse" "2.00" "2.00"
"Storage Zone" "1.00" "1.00"
"Storage 1" "1.00" "1.00"
"Storage 1.1" "1.00" "1.00"
"Storage 2" "0.00" "0.00"
The quantity on the Warehouse is increased by one and shows 2.0 instead of 1.0.