From 402924f6d7b6d073957e06321bc49e83638f2d5d Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas <maxime@atm-consulting.fr>
Date: Fri, 14 Apr 2017 15:12:32 +0200
Subject: [PATCH] Fix : no origin on stock mvmt when order set back to draft

---
 htdocs/commande/class/commande.class.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index e1b59f34772..462ba4756c5 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -464,6 +464,7 @@ class Commande extends CommonOrder
                     if ($this->lines[$i]->fk_product > 0)
                     {
                         $mouvP = new MouvementStock($this->db);
+                        $mouvP->origin = &$this;
                         // 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) { $error++; $this->error=$mouvP->error; break; }
-- 
GitLab