diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 6ba464b0a18bc2ae91159a8b66026ada34f8d3af..9051ab0bb2729ae3ad6dc748327b0f2ec4c51aeb 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1261,18 +1261,19 @@ class CommandeFournisseur extends CommonOrder
     /**
      * Add a product into a stock warehouse.
      *
-     * @param 	User		$user		User object making change
-     * @param 	int			$product	Id of product to dispatch
-     * @param 	double		$qty		Qty to dispatch
-     * @param 	int			$entrepot	Id of warehouse to add product
-     * @param 	double		$price		Unit Price for PMP value calculation (Unit price without Tax and taking into account discount)
-     * @param	string		$comment	Comment for stock movement
-	 * @param	date		$eatby		eat-by date
-	 * @param	date		$sellby		sell-by date
-	 * @param	string		$batch		Lot number
+     * @param 	User		$user					User object making change
+     * @param 	int			$product				Id of product to dispatch
+     * @param 	double		$qty					Qty to dispatch
+     * @param 	int			$entrepot				Id of warehouse to add product
+     * @param 	double		$price					Unit Price for PMP value calculation (Unit price without Tax and taking into account discount)
+     * @param	string		$comment				Comment for stock movement
+	 * @param	date		$eatby					eat-by date
+	 * @param	date		$sellby					sell-by date
+	 * @param	string		$batch					Lot number
+	 * @param	int			$fk_commandefourndet	Id of supplier order line
      * @return 	int						<0 if KO, >0 if OK
      */
-    function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='')
+    function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet='')
     {
         global $conf;
         $error = 0;
@@ -1292,8 +1293,8 @@ class CommandeFournisseur extends CommonOrder
             $this->db->begin();
 
             $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_dispatch ";
-            $sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec) VALUES ";
-            $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."')";
+            $sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet) VALUES ";
+            $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."')";
 
             dol_syslog(get_class($this)."::DispatchProduct", LOG_DEBUG);
             $resql = $this->db->query($sql);
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index bea467340e65747a047a65056ddbec9dc70a9a0d..d5ace69a09f46a9b3a011eff5d1cb2b0b5b21893 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -78,9 +78,10 @@ if ($_POST["action"] ==	'dispatch' && $user->rights->fournisseur->commande->rece
 			$qty = "qty_".$reg[1];
 			$ent = "entrepot_".$reg[1];
 			$pu = "pu_".$reg[1];	// This is unit price including discount
+			$fk_commandefourndet = "fk_commandefourndet_".$reg[1];
 			if (GETPOST($ent,'int') > 0)
 			{
-				$result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"));
+				$result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'));
 			}
 			else
 			{
@@ -251,22 +252,23 @@ if ($id > 0 || ! empty($ref))
 			print '<input type="hidden" name="action" value="dispatch">';
 			print '<table class="noborder" width="100%">';
 
-			$sql = "SELECT cfd.fk_product, sum(cfd.qty) as qty";
+			$sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
 			$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
+			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on (l.rowid = cfd.fk_commandefourndet)";
 			$sql.= " WHERE cfd.fk_commande = ".$commande->id;
-			$sql.= " GROUP BY cfd.fk_product";
+			$sql.= " GROUP BY l.rowid";
 
 			$resql = $db->query($sql);
 			if ($resql)
 			{
 				while ( $row = $db->fetch_row($resql) )
 				{
-					$products_dispatched[$row[0]] = $row[1];
+					$products_dispatched[$row[0]] = $row[2];
 				}
 				$db->free($resql);
 			}
 
-			$sql = "SELECT l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
+			$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
 			$sql.= " p.ref, p.label,  p.tobatch";
 			$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
 			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
@@ -317,7 +319,7 @@ if ($id > 0 || ! empty($ref))
 					}
 					else
 					{
-						$remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]);	// Calculation of dispatched
+						$remaintodispatch=($objp->qty - $products_dispatched[$objp->rowid]);	// Calculation of dispatched
 						if ($remaintodispatch < 0) $remaintodispatch=0;
 						if ($remaintodispatch)
 						{
@@ -343,7 +345,7 @@ if ($id > 0 || ! empty($ref))
 							print "</td>\n";
 
 							print '<td align="right">'.$objp->qty.'</td>';
-							print '<td align="right">'.$products_dispatched[$objp->fk_product].'</td>';
+							print '<td align="right">'.$products_dispatched[$objp->rowid].'</td>';
 
 							if ( !(empty($conf->productbatch->enabled)) && $objp->tobatch==1) {
 								print '<td colspan="2" align="center">'.img_picto_common($langs->trans('AddDispatchBatchLine'),'treemenu/plustop2.gif','onClick="AddLineBatch('.$i.')"').'</td>';
@@ -361,6 +363,7 @@ if ($id > 0 || ! empty($ref))
 								print '<td colspan="2">&nbsp</td>';
 							} else {
 								print '<input name="product'.$suffix.'" type="hidden" value="'.$objp->fk_product.'">';
+								print '<input name="fk_commandefourndet'.$suffix.'" type="hidden" value="'.$objp->rowid.'">';
 								print '<input name="pu'.$suffix.'" type="hidden" value="'.$up_ht_disc.'"><!-- This is a up including discount -->';
 							}
 
diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
index 0a9213a3d7355d8a46ecf91f83a439260c6d7847..dc912be428626d8de5107bc8f1c295b0e00420db 100755
--- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
+++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
@@ -1160,3 +1160,5 @@ ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_b
 -- this update change the old formated url on llx_bank_url
 UPDATE llx_bank_url set url = REPLACE( url, 'fiche.php', 'card.php');
 
+-- Add id commandefourndet in llx_commande_fournisseur_dispatch to correct /fourn/commande/dispatch.php display when several times same product in supplier order
+ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_commandefourndet INT(11) NOT NULL DEFAULT '0' AFTER fk_product;
diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
index 7eeb02ab5cf5b31104f840d2a627a76c580ae1cf..1c2cd348a74034d454e2a40e0b5bf93483d27bf1 100644
--- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
+++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
@@ -21,6 +21,7 @@ create table llx_commande_fournisseur_dispatch
   rowid          integer AUTO_INCREMENT PRIMARY KEY,
   fk_commande    integer,
   fk_product     integer,
+  fk_commandefourndet integer,
   qty            float,              -- qty
   fk_entrepot    integer,
   fk_user        integer,