diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index 2e7b4186a87..7b49722a25b 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -1300,6 +1300,17 @@ class Mo extends CommonObject
{
global $langs, $hookmanager, $conf, $form;
+ $langs->load('stocks');
+ $text_stock_options = $langs->trans("RealStockDesc").'
';
+ $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'
';
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'
' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'
' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'
' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'
' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : '');
+
print '
';
print '| '.$langs->trans('Ref').' | ';
print ''.$langs->trans('Qty');
@@ -1309,6 +1320,8 @@ class Mo extends CommonObject
print ' ('.$langs->trans("ForAQuantityToConsumeOf", $this->bom->qty).')';
}
print ' | ';
+ print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).' | ';
+ print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).' | ';
print ''.$langs->trans('QtyFrozen').' | ';
print ''.$langs->trans('DisableStockChange').' | ';
//print ''.$langs->trans('Efficiency').' | ';
@@ -1358,6 +1371,7 @@ class Mo extends CommonObject
if (!empty($line->fk_product)) {
$productstatic = new Product($this->db);
$productstatic->fetch($line->fk_product);
+ $productstatic->load_virtual_stock();
$this->tpl['label'] .= $productstatic->getNomUrl(1);
//$this->tpl['label'].= ' - '.$productstatic->label;
} else {
@@ -1370,6 +1384,9 @@ class Mo extends CommonObject
$this->tpl['qty_bom'] = $this->bom->qty;
}
+ $this->tpl['stock'] = $productstatic->stock_reel;
+ $this->tpl['seuil_stock_alerte'] = $productstatic->seuil_stock_alerte;
+ $this->tpl['virtual_stock'] = $productstatic->stock_theorique;
$this->tpl['qty'] = $line->qty;
$this->tpl['qty_frozen'] = $line->qty_frozen;
$this->tpl['disable_stock_change'] = $line->disable_stock_change;
diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php
index 478c6504979..98b39a637c3 100644
--- a/htdocs/mrp/tpl/originproductline.tpl.php
+++ b/htdocs/mrp/tpl/originproductline.tpl.php
@@ -39,6 +39,16 @@ $qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS');
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'])) {
+ print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte']));
+}
+print ' | ';
+print ''.((empty($this->tpl['virtual_stock']) ? 0 : price2num($this->tpl['virtual_stock'], 'MS')));
+if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['virtual_stock'] < $this->tpl['seuil_stock_alerte'])) {
+ print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte']));
+}
+print ' | ';
print ''.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').' | ';
print ''.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').' | ';
//print ''.$this->tpl['efficiency'].' | ';