diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 73c74cfb97e5868b403f07c15cfc9776a1bf8de3..6deaf7eae0829f5426c133f5308905e7213b84bf 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -45,21 +45,27 @@ function product_prepare_head($object)
$head[$h][2] = 'card';
$h++;
- $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
- $head[$h][1] = $langs->trans("SellingPrices");
- $head[$h][2] = 'price';
- $h++;
-
- if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
- || (! empty($conf->margin->enabled) && $user->rights->margin->liretous)
- )
+ if (! empty($object->status))
{
- $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
- $head[$h][1] = $langs->trans("BuyingPrices");
- $head[$h][2] = 'suppliers';
- $h++;
+ $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
+ $head[$h][1] = $langs->trans("SellingPrices");
+ $head[$h][2] = 'price';
+ $h++;
}
-
+
+ if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase
+ {
+ if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
+ || (! empty($conf->margin->enabled) && $user->rights->margin->liretous)
+ )
+ {
+ $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
+ $head[$h][1] = $langs->trans("BuyingPrices");
+ $head[$h][2] = 'suppliers';
+ $h++;
+ }
+ }
+
// Show category tab
/* No more required. Replaced with new multiselect component
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)