forked from Wavyzz/dolibarr
FIX: deleting a reception do not create reverse stock movements
This commit is contained in:
@@ -1116,7 +1116,7 @@ class Reception extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Stock control
|
||||
if (isModEnabled('stock') && !getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') && $this->statut > 0) {
|
||||
if (isModEnabled('stock') && getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') && $this->statut > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
|
||||
|
||||
$langs->load("agenda");
|
||||
@@ -1140,7 +1140,7 @@ class Reception extends CommonObject
|
||||
// we do not log origin because it will be deleted
|
||||
$mouvS->origin = null;
|
||||
|
||||
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
|
||||
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby ? $this->db->jdate($obj->eatby) : null, $obj->sellby ? $this->db->jdate($obj->sellby) : null, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $mouvS->error;
|
||||
|
||||
Reference in New Issue
Block a user