diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 0e57bebd922..4dfb47a3887 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -1073,7 +1073,8 @@ class BOM extends CommonObject
if ($res>0) {
$bom_child->calculateCosts();
$line->childBom[] = $bom_child;
- $this->total_cost += $bom_child->total_cost * $line->qty;
+ $line->total_cost = price2num( $bom_child->total_cost * $line->qty, 'MT');
+ $this->total_cost += $line->total_cost;
} else {
$this->error = $bom_child->error;
return -2;
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 61b394a3b0f..3897b875652 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -239,13 +239,13 @@ if ($resql) {
// Cost
if (!empty($sub_bom->id)) {
$sub_bom->calculateCosts();
- print '
'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).' | ';
+ print ''.price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT').' | ';
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->cost_price > 0) {
- print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).' | ';
+ print ''.price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT').' | ';
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
- print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).' | ';
+ print ''.price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT').' | ';
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
@@ -255,7 +255,7 @@ if ($resql) {
$obj = $object->db->fetch_object($resql_supplier_price);
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
- print ''.price($line_cost).' | ';
+ print ''.price2num($line_cost, 'MT').' | ';
$total_cost+= $line_cost;
}
}