diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index d139f235fd9..9ce484e5d43 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -482,7 +482,7 @@ class FormFile
// Language code (if multilang)
$out.= '
';
- if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
+ if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin=new FormAdmin($this->db);
@@ -508,6 +508,7 @@ class FormFile
$genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
}
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton='';
+ if (empty($modellist) && ! $showempty) $genbutton='';
$out.= $genbutton;
$out.= ' | ';