diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php
index ba1d7fccd86..97847427fcd 100644
--- a/htdocs/mrp/tpl/originproductline.tpl.php
+++ b/htdocs/mrp/tpl/originproductline.tpl.php
@@ -32,12 +32,30 @@ $qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ?
}*/
$qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS');
+$tmpproduct = new Product($this->db);
+$tmpproduct->fetch($line->fk_product);
+$tmpbom = new BOM($this->db);
+$res = $tmpbom->fetch($line->fk_bom_child);
+
?>
tpl['strike']) ? '' : ' strikefordisabled').'">';
-print '
'.$this->tpl['label'].' ';
+print '';
+if($res){
+ print $tmpproduct->getNomUrl(1);
+ print ' '.$langs->trans("or").' ';
+ print $tmpbom->getNomUrl(1);
+ print ' ';
+ print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open'));
+ print ' ';
+
+} else{
+ print $this->tpl['label'];
+}
+print ' ';
+//print ''.$this->tpl['label'].' ';
print ''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').' ';
print ''.(empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS'));
if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) {
@@ -61,5 +79,83 @@ print ' ';
//print ' ';
print ' ';
print ''."\n";
+
+// Select of all the sub-BOM lines
+$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
+$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
+$resql = $this->db->query($sql);
+
+if ($resql) {
+ // Loop on all the sub-BOM lines if they exist
+ while ($obj = $this->db->fetch_object($resql)) {
+ $sub_bom_product = new Product($this->db);
+ $sub_bom_product->fetch($obj->fk_product);
+ $sub_bom_product->load_stock();
+
+ $sub_bom = new BOM($this->db);
+ $sub_bom->fetch($obj->fk_bom_child);
+
+ $sub_bom_line = new BOMLine($this->db);
+ $sub_bom_line->fetch($obj->rowid);
+
+ //If hidden conf is set, we show directly all the sub-BOM lines
+ if (!empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
+ print '';
+ } else {
+ print ' ';
+ }
+
+ // Product OR BOM
+ print '';
+ if (!empty($obj->fk_bom_child)) {
+ print $sub_bom_product->getNomUrl(1);
+ print ' '.$langs->trans('or').' ';
+ print $sub_bom->getNomUrl(1);
+ } else {
+ print $sub_bom_product->getNomUrl(1);
+ print ' ';
+ }
+
+ // Qty
+ if ($sub_bom_line->qty_frozen > 0) {
+ print ''.price($sub_bom_line->qty, 0, '', 0, 0).' ';
+ } else {
+ print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).' ';
+ }
+
+ // Stock réel
+ if ($sub_bom_product->stock_reel > 0) {
+ print ''.$sub_bom_product->stock_reel.' ';
+ } else {
+ print ' ';
+ }
+
+ // Stock virtuel
+ if ($sub_bom_product->stock_theorique > 0) {
+ print ''.$sub_bom_product->stock_theorique.' ';
+ } else {
+ print ' ';
+ }
+
+ // Frozen qty
+ if ($sub_bom_line->qty_frozen > 0) {
+ print ''.$langs->trans('Yes').' ';
+ } else {
+ print ' ';
+ }
+
+ // Disable stock change
+ if ($sub_bom_line->disable_stock_change > 0) {
+ print ''.yn($sub_bom_line->disable_stock_change).' ';
+ } else {
+ print ' ';
+ }
+
+ print ' ';
+ print ' ';
+ print ' ';
+ }
+}
+
?>