diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 27d03465d983d516cc0eb30c3d06b19416fd410a..98843eddc1bc6f6ea24623ceaace2cdede978cbe 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -277,8 +277,8 @@ class FormFile
 				if (is_array($genallowed)) $modellist=$genallowed;
 				else
 				{
-					include_once(DOL_DOCUMENT_ROOT.'/fourn/facture/modules/modules_facturefournisseur.php');
-					$model=new ModelePDFFacturesSuppliers();
+					include_once(DOL_DOCUMENT_ROOT.'/includes/modules/supplier_invoice/modules_facturefournisseur.php');
+					$model=new ModelePDFSuppliersInvoices();
 					$modellist=$model->liste_modeles($this->db);
 				}
 			}
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index e33bd3a081dc1145a17fd6802baa50fc7b8217a5..294d1fdc6323b3308faa871d4e442e13f93e08d0 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -31,6 +31,7 @@
 require("../../main.inc.php");
 require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
 require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php');
+require_once(DOL_DOCUMENT_ROOT.'/includes/modules/supplier_invoice/modules_facturefournisseur.php');
 require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
 require_once(DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php');
 require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
@@ -463,7 +464,57 @@ if ($_GET['action'] == 'reopen' && $user->rights->fournisseur->facture->creer)
 	}
 }
 
+/*
+ * Build document
+ */
 
+if ($_REQUEST['action']	== 'builddoc')	
+{
+	/*
+	 * Generation de la	facture
+	 * definit dans	/includes/modules/supplier_invoice/modules_facturefournisseur.php
+	 */
+
+	// Sauvegarde le dernier module	choisi pour	generer	un document
+	$facture=	new	FactureFournisseur($db);
+	$facture->fetch($_REQUEST['facid']);
+	if ($_REQUEST['model'])
+	{
+		$facture->setDocModel($user, $_REQUEST['model']);
+	}
+
+	$outputlangs = $langs;
+	if (! empty($_REQUEST['lang_id']))
+	{
+		$outputlangs = new Translate("",$conf);
+		$outputlangs->setDefaultLang($_REQUEST['lang_id']);
+	}
+	$result=supplier_invoice_pdf_create($db, $facture,$facture->modelpdf,$outputlangs);
+	if ($result	<= 0)
+	{
+		dol_print_error($db,$result);
+		exit;
+	}
+	else
+	{
+		Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$facture->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
+		exit;
+	}
+}
+
+// Delete file in doc form
+if ($action=='remove_file')
+{
+	$facture = new FactureFournisseur($db);
+
+	if ($facture->fetch($id))
+	{
+		$upload_dir =	$conf->fournisseur->facture->dir_output . "/";
+		$file =	$upload_dir	. '/' .	$_GET['file'];
+		dol_delete_file($file);
+		$mesg	= '<div	class="ok">'.$langs->trans("FileWasRemoved").'</div>';
+	}
+}
 
 
 /*
@@ -1234,40 +1285,34 @@ else
 		print '</div>';
 
 
+		print '<table width="100%"><tr><td width="50%" valign="top">';
+		print '<a name="builddoc"></a>'; // ancre
 
-		if ($_GET['action'] != 'presend')
-		{
-			print '<table width="100%"><tr><td width="50%" valign="top">';
-			print '<a name="builddoc"></a>'; // ancre
-
-			/*
-			 * Documents generes
-			 */
-			$filename=dol_sanitizeFileName($fac->ref);
-			$filedir=$conf->fournisseur->dir_output.'/facture/'.get_exdir($fac->id,2).$fac->id;
-			$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
-			//$genallowed=$user->rights->fournisseur->facture->creer;
-			$genallowed=false;	// TODO Waiting for supplier invoice generation
-			$delallowed=$user->rights->fournisseur->facture->supprimer;
-
-			$var=true;
-
-			$somethingshown=$formfile->show_documents('facture_fournisseur',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
-
-
-			print '</td><td valign="top" width="50%">';
-
-			print '<br>';
-
-			// List of actions on element
-			/*
-			include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
-			$formactions=new FormActions($db);
-			$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid);
-			*/
+		/*
+		* Documents generes
+		*/
+			
+		$facfournref=dol_sanitizeFileName($fac->ref);
+		$file=$conf->fournisseur->dir_output.'/facture/'. $facfournref .	'/'	. $facfournref . '.pdf';
+		$relativepath =	$facfournref.'/'.$facfournref.'.pdf';
+		$filedir = $conf->fournisseur->dir_output	. '/facture/' .	$facfournref;
+		$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
+		$genallowed=$user->rights->fournisseur->facture->creer;
+		$delallowed=$user->rights->fournisseur->facture->supprimer;
+
+		$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$facture->modelpdf);
+			
+		print '</td><td valign="top" width="50%">';
+		print '<br>';
+
+		// List of actions on element
+		/*
+		include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
+		$formactions=new FormActions($db);
+		$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid);
+		*/
 
-			print '</td></tr></table>';
-		}
+		print '</td></tr></table>';
 	}
 }