diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index ab4c85f865d..88cd102ebb9 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -994,6 +994,10 @@ class Documents extends DolibarrApi $modulepart = 'mrp'; require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; $object = new Mo($this->db); + } elseif ($modulepart == 'stock') { + $modulepart = 'stock'; + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + $object = new Entrepot($this->db); } elseif ($modulepart == 'ecm') { throw new RestException(500, 'Using a non empty "ref" is not compatible with using modulepart = '.$modulepart); } else { diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 051c429e885..5837880f1e8 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -391,7 +391,7 @@ if (empty($reshook)) { $moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i); $moline->role = 'produced'; $moline->fk_mrp_production = $line->id; - $moline->fk_stock_movement = $idstockmove; + $moline->fk_stock_movement = (($idstockmove == 0) ? null : $idstockmove); $moline->fk_user_creat = $user->id; $resultmoline = $moline->create($user);