Commit Graph

9 Commits

Author SHA1 Message Date
Lois Rilo
9fecf39399 [13.0][MIG] stock_available_unreserved
Standard migration. Also some copyrights are removed because they were added by mistake in the fist place (copy+paste issues ;) )
2019-12-20 14:05:20 +01:00
Lois Rilo
b9f9d02672 [IMP] stock_available_unreserved: black, isort 2019-12-20 14:04:31 +01:00
Lois Rilo
2650946eac [12.0][UPD] stock_available_unreserved:
* update author's name after recent rebranding of Eficent to ForgeFlow.
* change license to lgpl as agreed by the authors.
* update readme to new format.
2019-12-20 14:04:31 +01:00
ougc27
1697f7b719 [MIG] stock_available_unreserved: Migration to V12 2019-12-20 14:04:31 +01:00
Atte Isopuro
9858cd5d4b stock_available_unreserved: allow searching by unreserved quantities 2019-12-20 12:34:12 +01:00
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
mpanarin
07e173114f [MIG] stock_available_unreserved: migrate Odoo 11 2019-12-20 12:34:12 +01:00
Stefan Rijnhart
d79518b979 [MIG] stock_available_unreserved 2019-12-20 12:34:12 +01:00
Jordi Ballester Alomar
4443fb28e3 new module 'stock_available_unreserved' (#206)
* [ADD] new module 'stock_available_unreserved'
2019-12-20 12:34:12 +01:00