Guewen Baconnier 30a14dab0f Fix computation of stock available unreserved
The computation of the unreserved available amount using the
StockQuant._get_available_quantity was wrong as soon as more than one
quant was found for the same product. It can easily happen when you have
sublocations and a quant in each location.

The reason is that the algorithm was:

1. searching for all the quants for a given product
2. calling StockQuant._get_available_quantity for each quant
3. _get_available_quantity is an @api.model method, which itself will
search for all quants for the product and the given location and
children

Which means that if you have these locations:

Stock
Stock > Bin A
Stock > Bin B

And these quants:

1. Product: Product A
   Location: Bin A
   Quantity: 60
   Reserved: 0

2. Product: Product A
   Location: Bin B
   Quantity: 10
   Reserved: 0

Instead of 70, the result was 140. (One loop for each quant, each loop
recomputing the total quantity in _get_available_quantity, all summed
togethed, for each new quant, an additional sum would be added).

Ultimately, the _get_available_quantity method does the sum of (quantity
- quantity reserved). This commit uses the same logic than the 10.0
branch, it finds the quants contextually using
ProductProduct._get_domain_locations and get the available quantity as
the sum of (quantity - quantity reserved).

We can't really use StockQuant._get_available_quantity because this one
expects a location, while here we don't necessarily know it.

I removed _product_available_not_res_hook which seems to have no
purpose, it does not receive the result of the computation and its own
result is unused.
2019-12-20 12:34:12 +01:00
2019-12-17 10:00:58 +00:00
2019-12-17 10:00:58 +00:00
2019-11-19 21:15:42 +01:00
2019-10-12 12:30:40 +02:00
2019-10-12 12:30:40 +02:00
2019-09-29 23:49:04 +02:00
2019-10-12 12:30:40 +02:00
2019-10-12 12:30:40 +02:00
2019-10-12 12:30:40 +02:00
2019-10-12 12:30:40 +02:00
2019-10-12 12:30:40 +02:00

Build Status Coverage Status

Odoo Stock Logistics Warehouse

This project aim to deal with modules related to the management of warehouses. You'll find modules that:

  • Ease inventory by adding various possibilities
  • Move all product from one location to another
  • Manage the product catalog (merge them,..)

Please don't hesitate to suggest one of your module to this project. Also, you may want to have a look on those other projects here:

Description
Odoo Warehouse Management Addons
Readme 142 MiB
Languages
HTML 50.9%
Python 48.2%
JavaScript 0.8%
SCSS 0.1%