mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Fix: The origin of the stock movement is not being recorded
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -518,6 +518,7 @@ class Commande extends CommonOrder
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// We decrement stock of product (and sub-products)
|
||||
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr", $num));
|
||||
if ($result < 0) {
|
||||
@@ -645,6 +646,7 @@ class Commande extends CommonOrder
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// We increment stock of product (and sub-products)
|
||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref));
|
||||
if ($result < 0) {
|
||||
@@ -823,6 +825,7 @@ class Commande extends CommonOrder
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// We increment stock of product (and sub-products)
|
||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed
|
||||
if ($result < 0) {
|
||||
|
||||
Reference in New Issue
Block a user