diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 01d5bd19daa..2792dfc9344 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -373,8 +373,8 @@ class MouvementStock extends CommonObject } } else { // If not found, we add record $productlot = new Productlot($this->db); - $productlot->origin = !empty($this->origin) ? (empty($this->origin->origin_type) ? $this->origin->element : $this->origin->origin_type) : ''; - $productlot->origin_id = !empty($this->origin) ? $this->origin->id : 0; + $productlot->origin = !empty($this->origin_type) ? $this->origin_type : ''; + $productlot->origin_id = !empty($this->origin_id) ? $this->origin_id : 0; $productlot->entity = $conf->entity; $productlot->fk_product = $fk_product; $productlot->batch = $batch;