Merge branch 'FIX_noUpdateProductionNeededForMo' of github.com:atm-adrien/dolibarr into FIX_noUpdateProductionNeededForMo

This commit is contained in:
Adrien Raze 2023-04-05 11:45:17 +02:00
commit 21900345b8
2 changed files with 6 additions and 6 deletions

View File

@ -638,21 +638,21 @@ class Mo extends CommonObject
$oldQty = $this->oldQty;
$newQty = $this->qty;
if($newQty != $oldQty && !empty($this->oldQty)) {
if ($newQty != $oldQty && !empty($this->oldQty)) {
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'mrp_production WHERE fk_mo = ' . (int) $this->id;
$resql = $this->db->query($sql);
if($resql) {
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$moLine = new MoLine($this->db);
$res = $moLine->fetch($obj->rowid);
if(!$res) $error++;
if (!$res) $error++;
if($moLine->role == 'toconsume' || $moLine->role == 'toproduce') {
if ($moLine->role == 'toconsume' || $moLine->role == 'toproduce') {
if (empty($moLine->qty_frozen)) {
$qty = $newQty * $moLine->qty / $oldQty;
$moLine->qty = price2num($qty * (!empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and more presition
$res = $moLine->update($user);
if(!$res) $error++;
if (!$res) $error++;
}
}
}

View File

@ -123,7 +123,7 @@ if (empty($reshook)) {
$backurlforlist = dol_buildpath('/mrp/mo_list.php', 1);
$object->oldQty = $object->qty;
$object->oldQty = $object->qty;
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {