Commit Graph

20 Commits

Author SHA1 Message Date
Denis Roussel
93df11e803 [14.0][IMP] stock_available_unreserved: Add hooks 2022-09-07 10:04:42 +02:00
Sébastien Alix
c95c776e4a [FIX] Fix access right issues when using actions 2022-01-31 15:40:25 +01:00
Denis Roussel
e2f4eb6ea8 [14.0][IMP] stock_available_unreserved: Improve field help message 2021-07-08 13:35:30 +02:00
sbejaoui
c4220b79a8 [IMP] - use available_quantity to compute contains_unreserved 2021-06-09 10:25:25 +02:00
sbejaoui
0affe055f6 [14.0][MIG] - stock_available_unreserved 2021-06-07 10:44:28 +02:00
hveficent
1fe22f9750 [FIX] Fix compute contains_unreserved on NewId records 2021-06-03 17:49:27 +02:00
Lois Rilo
0a54e9f0eb [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 ;) )
2021-06-03 17:49:27 +02:00
Lois Rilo
6a843ff7ae [IMP] stock_available_unreserved: black, isort 2021-06-03 17:49:27 +02:00
Lois Rilo
5b266b7db0 [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.
2021-06-03 17:49:27 +02:00
ougc27
59c04a0761 [ADD][stock_available_unreserved] - Missing depends on qty_available_not_reserved compute method in order to update the quantity. 2021-06-03 17:49:27 +02:00
ougc27
4456189033 [MIG] stock_available_unreserved: Migration to V12 2021-06-03 17:49:27 +02:00
Atte Isopuro
e37afcaba9 stock_available_unreserved: allow searching by unreserved quantities 2021-06-03 17:49:27 +02:00
Guewen Baconnier
e707c810e3 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.
2021-06-03 17:49:27 +02:00
mpanarin
70d106b243 [MIG] stock_available_unreserved: migrate Odoo 11 2021-06-03 17:49:27 +02:00
Denis Roussel
53f8f29a4e [FIX] stock_available: Some affectations 2021-06-03 17:49:27 +02:00
Laurent Mignon (ACSONE)
1e2f47c597 [IMP] stock_available_unreserved: Improve perf in stock computation;
Read quants without lang into the context to avoid sql join on ir.translations
Iter on product with prefetch_fields=False and lang='' to avoid reading useless column ad join on ir.translations
2021-06-03 17:49:27 +02:00
Cédric Pigeon
3c896fc9bb [CHG] optimize stock computation by avoiding to call useless compute 2021-06-03 17:49:27 +02:00
mreficent
b9403b39f2 [IMP] fast compute
_product_available() method is computed only once by location
2021-06-03 17:49:27 +02:00
Stefan Rijnhart
3df595033b [MIG] stock_available_unreserved 2021-06-03 17:49:27 +02:00
Jordi Ballester Alomar
1d6f01f59e new module 'stock_available_unreserved' (#206)
* [ADD] new module 'stock_available_unreserved'
2021-06-03 17:49:27 +02:00