diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index f35d30963ba..5992578a6e0 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -167,9 +167,14 @@ if ($filtertype != 1) {
}
}
$total_cost = 0;
+$tmpbom->calculateCosts();
print '
';
$coldisplay++;
-echo ''.price($line->total_cost).'';
+if (!empty($line->fk_bom_child)) {
+ echo ''.price($tmpbom->total_cost).'';
+} else {
+ echo ''.price($line->total_cost).'';
+}
print ' | ';
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
@@ -317,15 +322,5 @@ if ($resql) {
}
}
-// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
-// TODO Remove this bad practice. We should not replace content of ouput using javascript but value should be good during generation of output.
-if ($total_cost > 0) {
- $line->total_cost = price($total_cost);
- ?>
-
- \n";