diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 7419c4618e0..0a3a3b34e7a 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -109,7 +109,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
if (!empty($conf->global->BOM_SUB_BOM)) {
print ' '.$langs->trans("or").' '.$langs->trans("BOM");
// TODO Add component to select a BOM
- print '';
+ $form->select_bom();
}
print '';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 88fca7b536a..fe47047150d 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2362,6 +2362,57 @@ class Form
}
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
+ /**
+ * Return list of BOM for customer in Ajax if Ajax activated or go to select_produits_list
+ *
+ * @param int $selected Preselected BOM id
+ * @param string $htmlname Name of HTML select field (must be unique in page).
+ * @param int $limit Limit on number of returned lines
+ * @param int $status Sell status -1=Return all bom, 0=Draft BOM, 1=Validated BOM
+ * @param int $type type of the BOM (-1=Return all BOM, 0=Return disassemble BOM, 1=Return manufacturing BOM)
+ * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
+ * @param string $morecss Add more css on select
+ * @return void|string
+ */
+ public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '')
+ {
+ // phpcs:enable
+ global $conf, $user, $langs, $db;
+ $error = 0;
+ $out = '';
+
+ $out .= '