From 475d7190142767b328e13d964bf04fdc93ee11d4 Mon Sep 17 00:00:00 2001 From: brad Date: Thu, 18 Dec 2025 15:36:12 +1100 Subject: [PATCH 1/3] Fix - Error when producing dissassembly MO Trying to product a dissassembly MO causes the produced SQL insert statement to fail on a database constraint related to fk_stock_movement, the consume statement was successful. The consume statement was checking for a '0' and setting the value to 'null' but the produce line was not doing this check. Adding this check to fk_stock_movement fixes the error and generates the database entries --- htdocs/mrp/mo_production.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 051c429e885..56075474813 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); From 0ea4a4d071e3ffc3eb3887cf2bc41f7667015ffc Mon Sep 17 00:00:00 2001 From: William Mead Date: Thu, 18 Dec 2025 09:41:43 +0100 Subject: [PATCH 2/3] Added stock warehouse document upload --- htdocs/api/class/api_documents.class.php | 4 ++++ 1 file changed, 4 insertions(+) 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 { From 1d4fc65fbeb1f1b69346d98ea057fa7ab1df94bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Dec 2025 15:56:54 +0100 Subject: [PATCH 3/3] Update mo_production.php --- htdocs/mrp/mo_production.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 56075474813..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 == 0 ? null : $idstockmove; + $moline->fk_stock_movement = (($idstockmove == 0) ? null : $idstockmove); $moline->fk_user_creat = $user->id; $resultmoline = $moline->create($user);