Commit Graph

401 Commits

Author SHA1 Message Date
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
Denis Roussel
b8afda67f7 [FIX] stock_available: Some affectations 2019-12-20 12:34:12 +01:00
Laurent Mignon (ACSONE)
08dc76405e [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
2019-12-20 12:34:12 +01:00
Cédric Pigeon
b39846cc5a [CHG] optimize stock computation by avoiding to call useless compute 2019-12-20 12:34:12 +01:00
mreficent
36b64e4b85 [IMP] fast compute
_product_available() method is computed only once by location
2019-12-20 12:34:12 +01:00
Stefan Rijnhart
d79518b979 [MIG] stock_available_unreserved 2019-12-20 12:34:12 +01:00
OCA Transbot
ecab13d267 OCA Transbot updated translations from Transifex 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
ps-tubtim
d8a437710a [MIG] stock_warehouse_orderpoint_stock_info: Migration to 13.0 2019-12-19 10:53:10 +07:00
ps-tubtim
dcc895ac41 [IMP] stock_warehouse_orderpoint_stock_info: black, isort 2019-12-19 10:04:40 +07:00
Rodrigo Macedo
6982ed997d Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8 of 8 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_warehouse_orderpoint_stock_info
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_warehouse_orderpoint_stock_info/pt_BR/
2019-12-19 10:02:51 +07:00
黎伟杰
a5745c20d5 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8 of 8 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_warehouse_orderpoint_stock_info
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_warehouse_orderpoint_stock_info/zh_CN/
2019-12-19 10:02:51 +07:00
OCA-git-bot
9f941defa7 [UPD] README.rst 2019-12-19 10:02:51 +07:00
OCA Transbot
8d3469f68a Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_warehouse_orderpoint_stock_info
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_warehouse_orderpoint_stock_info/
2019-12-19 10:02:51 +07:00
oca-travis
c7a8a1d40e [UPD] Update stock_warehouse_orderpoint_stock_info.pot 2019-12-19 10:02:51 +07:00
Saran L
1815e31519 [MIG] stock_warehouse_orderpoint_stock_info: Migration to 12.0 2019-12-19 10:02:51 +07:00
OCA Transbot
c2460ff4ae Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
2019-12-19 10:02:51 +07:00
oca-travis
46166a9e83 [UPD] Update stock_warehouse_orderpoint_stock_info.pot 2019-12-19 10:02:51 +07:00
oca-travis
c046d2ab32 [UPD] Update stock_warehouse_orderpoint_stock_info.pot 2019-12-19 10:02:51 +07:00
OCA Transbot
dc19fab8b0 OCA Transbot updated translations from Transifex 2019-12-19 10:02:51 +07:00
mpanarin
a2112f6659 [MIG] stock_warehouse_orderpoint_stock_info: Migration to Odoo 11 2019-12-19 10:02:51 +07:00
mreficent
92cbd9a464 [MIG] stock_warehouse_orderpoint_stock_info: Migration to 10.0 2019-12-19 10:02:51 +07:00
Jordi Ballester
60df43819e [MIG] migrate to version 9.0 2019-12-19 10:02:51 +07:00
jbeficent
58b3191eee add OCA style
field available cannot be a stored field.
remove field 'available', as it was not correctly defined
remove unused method
2019-12-19 10:02:51 +07:00
darshan-serpent
d868577b68 added test cases.
tested computation for product availability.
2019-12-19 10:02:51 +07:00
mikelarre
f8825abf1a added incomin, outgoing and forecast stock
stock_warehouse_orderpoint_stock_info: Search orderpoint rules by product category
2019-12-19 10:02:51 +07:00
oihane
b8e0d8c30b Update oca_dependencies to avoid runbot fail * deleted .pot files * copied travis from wip * added translation status to readme 2019-12-19 10:02:50 +07:00
Pedro M. Baeza
d2b88fcd69 OCA Transbot updated translations from Transifex 2019-12-19 10:02:50 +07:00
oihane
bc9731773a New module <stock_warehouse_orderpoint_stock_info>
removed innecessary data
Domain on filter mistaken
Expand AUTHORS
Changed email
2019-12-19 10:02:50 +07:00
ps-tubtim
a6e508c51d [IMP] stock_removal_location_by_priority: black, isort
[MIG] stock_removal_location_by_priority: Migration to 13.0
2019-12-19 09:11:57 +07:00
黎伟杰
4c56b522d9 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8 of 8 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_removal_location_by_priority
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_removal_location_by_priority/zh_CN/
2019-12-18 17:32:00 +07:00
黎伟杰
9342dad39a Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8 of 8 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_removal_location_by_priority
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_removal_location_by_priority/zh_CN/
2019-12-18 17:32:00 +07:00
Alexandre Fayolle
1190f47ded Translated using Weblate (French)
Currently translated at 100.0% (8 of 8 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_removal_location_by_priority
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_removal_location_by_priority/fr/
2019-12-18 17:32:00 +07:00
OCA-git-bot
ddecd0aa6a [UPD] README.rst 2019-12-18 17:32:00 +07:00
OCA Transbot
87007334b2 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_removal_location_by_priority
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_removal_location_by_priority/
2019-12-18 17:32:00 +07:00
oca-travis
9dfe2bc99e [UPD] Update stock_removal_location_by_priority.pot 2019-12-18 17:32:00 +07:00
mreficent
b4e6de4721 [MIG] stock_removal_location_by_priority: Migration to 12.0 2019-12-18 17:32:00 +07:00
OCA Transbot
0864acd8ad Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
2019-12-18 17:32:00 +07:00
mreficent
bdb3a9ca77 [FIX] stock_removal_by_priority: avoid pre-init-hook if reinstalled 2019-12-18 17:32:00 +07:00
oca-travis
f0cf92754c [UPD] Update stock_removal_location_by_priority.pot 2019-12-18 17:32:00 +07:00
OCA-git-bot
13e1a725ab [UPD] README.rst 2019-12-18 17:32:00 +07:00
Lois Rilo
5e08e3eedf [11.0][MIG] stock_removal_location_by_priority 2019-12-18 17:32:00 +07:00
oca-travis
2d818079aa [UPD] Update stock_removal_location_by_priority.pot 2019-12-18 17:32:00 +07:00
mreficent
9f218109e6 [IMP/FIX] Removal priority should be independent of company 2019-12-18 17:32:00 +07:00
mreficent
83fa5752d1 [MIG] stock_removal_location_by_priority: Migration to 10.0 2019-12-18 17:32:00 +07:00
OCA Transbot
453764f452 OCA Transbot updated translations from Transifex 2019-12-18 17:32:00 +07:00
lreficent
1f7f508460 stock_removal_location_by_priority: Add init_hook to speed up installation 2019-12-18 17:32:00 +07:00
mreficent
0510ce80d2 Stock Removal Location by Priority 2019-12-18 17:32:00 +07:00
ps-tubtim
f8256740a1 [MIG] account_move_line_product: Migration to 13.0 2019-12-18 17:21:58 +07:00