Hello,
is there any way to hide best buying price for a certain user? (I need user to see stocks without seeing buying prices)
Hi
You may try to create a group that could not see the supplier information .
Thank you @trekmorris
I didnât gave this user any rights on suppliers but still this user can see 5he best price under stock tap
I cannot remove right to read stock from this user as his job ( sales) require to check products in stock to sell
Hi
What is your dolibarr version ?
As my testing , if i only enable the permissions " can read / create / edit the information of product " , then that user can only see the selling price , canât see the buying price .
Hello @trekmorris
Iâm using version 15
User has read only for products, issue is in stock tap
( user has read only for stock )
Hi
Sorry , so it may be not possible to do this .
Thank you @trekmorris
Dear @trekmorris
as a workaround is it possible to create a scheduled job to email the list of available stock of each product (without sharing any info about prices)?
Hi
I think it will be possible , but you will need to know how to write the php code to get the data from mysql and export it to a excel file .
And use cron job to do it .
Of course that is my one idea , but i never do that before .
Thank you very much @trekmorris
There is a way to hide cost price & buying price from stock tab but you will have to change some code.
Go to this path:
product/stock/product.php
Open product.php then search for this:
// Minimum Price
print '<tr><td>'.$langs->trans("BuyingPriceMin").'</td>';
print '<td>';
$product_fourn = new ProductFournisseur($db);
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
print $product_fourn->display_price_product_fournisseur();
} else {
print $langs->trans("NotDefined");
}
}
print '</td></tr>';
The code should be commented like this with /* */:
// Minimum Price
/* print '<tr><td>'.$langs->trans("BuyingPriceMin").'</td>';
print '<td>';
$product_fourn = new ProductFournisseur($db);
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
print $product_fourn->display_price_product_fournisseur();
} else {
print $langs->trans("NotDefined");
}
}
print '</td></tr>'; */
Then for cost price search for the following and comment the code just like buying price above:
// Cost price. Can be used for margin module for option "calculate margin on explicit cost price
/* print '<tr><td>';
$textdesc = $langs->trans("CostPriceDescription");
$textdesc .= "<br>".$langs->trans("CostPriceUsage");
$text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', '');
print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print '</td><td>';
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print '</td></tr>'; */
This will hide buying price & cost price in stock tab for all users. Those users who have permissions for suppliers/vendors can see both buying price & cost price from buying price tab.
Hi
Thanks for the solution of this .
Thank you @ariffidaali
i test it and it seems working but I still need your help and support to hide Weighted average price Input stock value
Hi
You just need to do the same thing .
Find the code :
`// AWP
print ââ;
print $form->textwithpicto($langs->trans(âAverageUnitPricePMPShortâ), $langs->trans(âAverageUnitPricePMPDescâ));
print ââ;
print ââ;
if ($object->pmp > 0) {
print price($object->pmp).â '.$langs->trans(âHTâ);
}
print ââ;
print ââ;
And add /* */ as below :
// AWP
/*
print ââ;
print $form->textwithpicto($langs->trans(âAverageUnitPricePMPShortâ), $langs->trans(âAverageUnitPricePMPDescâ));
print ââ;
print ââ;
if ($object->pmp > 0) {
print price($object->pmp).â '.$langs->trans(âHTâ);
}
print ââ;
print ââ;*/
Great I was about to answer your question but you figured it out. Nice!
Hello @ariffidaali
many thanks for your help. could you please let me know
1- which file ( file name) I need to edit to hide AWP and input price?
2- which files (file name) I need to edit to hide margin and mark up?
Thanks again for your great support
Hello @mmamin
- Please attach screen shot
- For margin and mark up disable margin permission for that user.
Thank you @ariffidaali
I have one question, is there any way to apply that solution for a certain user or group of users only instead of hide those information for all users?
Thanks
@mmamin
You create a group then assign it permissions. Then add the user to the group. The user will automatically inherit the permissions. So all you need is to add the user to that group instead of assigning permissions to each user every time.