Merge pull request #17284 from fmarcet/develop

New: Make more efficient data loading on replenishment
This commit is contained in:
Laurent Destailleur 2021-04-16 20:17:16 +02:00 committed by GitHub
commit 10668ddfcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -750,7 +751,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!empty($conf->global->STOCK_SUPPORTS_SERVICES) || $objp->fk_product_type == 0) {
$prod->fetch($objp->rowid);
$prod->load_stock('warehouseopen, warehouseinternal', $draftchecked);
$prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock?', novirtual':''), $draftchecked);
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -785,11 +786,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Force call prod->load_stats_xxx to choose status to count (otherwise it is loaded by load_stock function)
if (isset($draftchecked)) {
$result = $prod->load_stats_commande_fournisseur(0, '0,1,2,3,4');
} else {
} elseif (!$usevirtualstock) {
$result = $prod->load_stats_commande_fournisseur(0, '1,2,3,4');
}
$result = $prod->load_stats_reception(0, '4');
if (!$usevirtualstock) {
$result = $prod->load_stats_reception(0, '4');
}
//print $prod->stats_commande_fournisseur['qty'].'<br>'."\n";
//print $prod->stats_reception['qty'];