Thanks guys for the help, I found a free app to hide cost price by Cybrosys Techno Solutions
for the sale price I have tried to do the same thing but it did not work here is the code and the error I am getting if someone can help:
/security/hide_sell_price_groups.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Access to the sell price -->
<record id="groups_view_sell_price" model="res.groups">
<field name="name">View Sell Price</field>
<field name="users" eval="[Command.link(ref('base.user_root')), Command.link(ref('base.user_admin'))]"/>
</record>
</data>
</odoo>
/views/product_product_views.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Product Variant Form View -->
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.product.view.form.inherited.hide.sell.price</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="lst_price" position="attributes">
<attribute name="groups">hide_sell_price.groups_view_sell_price</attribute>
</field>
</field>
</record>
<!-- Product Variant Tree View -->
<record id="product_product_tree_view" model="ir.ui.view">
<field name="name">product.product.view.tree.inherited.hide.sell.price</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view"/>
<field name="arch" type="xml">
<field name="lst_price" position="attributes">
<attribute name="groups">hide_sell_price.groups_view_sell_price</attribute>
</field>
</field>
</record>
<record id="product_variant_easy_edit_view" model="ir.ui.view">
<field name="name">product.product.view.tree.inherited.hide.sell.price</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_variant_easy_edit_view"/>
<field name="arch" type="xml">
<field name="lst_price" position="attributes">
<attribute name="groups">hide_sell_price.groups_view_sell_price</attribute>
</field>
</field>
</record>
</odoo>
/views/product_template_views.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Product Template Form View -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.view.form.inherit.hide.sell.price</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="lst_price" position="attributes">
<attribute name="groups">hide_sell_price.groups_view_sell_price</attribute>
</field>
</field>
</record>
<!-- Product Template Tree View -->
<record id="product_template_tree_view" model="ir.ui.view">
<field name="name">product.template.view.tree.inherit.hide.sell.price</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<field name="lst_price" position="attributes">
<attribute name="groups">hide_sell_price.groups_view_sell_price</attribute>
</field>
</field>
</record>
</odoo>
and here is the error
odoo.tools.convert.ParseError: while parsing /home/odoo/odoo18/custom_addons/hide_sell_price/views/product_template_views.xml:4
Error during parsing or validation of the view:
The element <field name="lst_price"> cannot be located in the parent view
{
"file": "/home/odoo/odoo18/custom_addons/hide_sell_price/views/product_template_views.xml",
"line": 1,
"name": "product.template.view.form.inherit.hide.sell.price",
"view": ir.ui.view(3570,),
"view.model": "product.template",
"view.parent": ir.ui.view(470,),
"xmlid": "product_template_form_view"
}
Thanks for your answer! I am new to Odoo. Could you please provide a step-by-step guide on how to implement this?
You can search for more detailed answers, but you need to understand how Odoo works and that is beyond the scope of a Help question and answer (in my opinion). I did write one more detailed answer a while back (https://www.odoo.com/forum/help-1/re-how-to-disable-update-cost-on-sales-user-176326/#answer-176326) and there is some useful information on my website http://odootricks.tips/