diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index bc0e8cff3bd..10c13d0313f 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2612,6 +2612,7 @@ class Societe extends CommonObject
$datas = [];
$option = $params['option'] ?? '';
+ $nofetch = empty($params['nofetch']) ? false : true;
$name = $this->name;
if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -2724,6 +2725,12 @@ class Societe extends CommonObject
if (isModEnabled('accounting') && $this->fournisseur) {
$datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur;
}
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1);
+ }
$datas['divclose'] = '';
@@ -2789,6 +2796,7 @@ class Societe extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';