first commit

This commit is contained in:
admin.suherdy 2025-11-14 08:06:00 +07:00
commit aa82690009
4 changed files with 74 additions and 0 deletions

15
README.rst Normal file
View File

@ -0,0 +1,15 @@
=======================
Hide Update Quantity Button
=======================
This module hides the "Update Quantity" button in product forms for users who are not in the ERP manager group.
Configuration
=============
No configuration required. Once installed, only users belonging to the base.group_erp_manager group can access the "Update Quantity" button.
Usage
=====
After installing this module:
- Users in the ERP Manager group (base.group_erp_manager) will continue to see the "Update Quantity" button
- All other users will not see the button in product forms

1
__init__.py Normal file
View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

20
__manifest__.py Normal file
View File

@ -0,0 +1,20 @@
{
'name': 'Hide Update Quantity Button',
'version': '18.0.1.0.0',
'category': 'Inventory',
'summary': 'Hide Update Quantity button for non-ERP managers',
'description': """
This module hides the 'Update Quantity' button in product forms for users who are not in the ERP manager group.
Only users belonging to the base.group_erp_manager group can access the 'Update Quantity' button.
""",
'author': 'Custom Development',
'depends': [
'stock',
],
'data': [
'views/product_views.xml',
],
'installable': True,
'auto_install': False,
'application': False,
}

38
views/product_views.xml Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Inherit the product template form view to modify the Update Quantity button visibility -->
<record id="product_template_form_view_procurement_button_inherit" model="ir.ui.view">
<field name="name">product.template.form.view.procurement.button.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_update_quantity_on_hand' and @type='object' and @string='Update Quantity']" position="attributes">
<attribute name="groups">base.group_erp_manager</attribute>
</xpath>
</field>
</record>
<!-- Inherit the product form view to modify the Update Quantity button visibility -->
<record id="product_form_view_procurement_button_inherit" model="ir.ui.view">
<field name="name">product.form.view.procurement.button.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_update_quantity_on_hand' and @type='object' and @string='Update Quantity']" position="attributes">
<attribute name="groups">base.group_erp_manager</attribute>
</xpath>
</field>
</record>
<!-- Inherit the easy edit product view to modify the Update Quantity button visibility -->
<record id="product_product_view_form_easy_inherit_stock_inherit" model="ir.ui.view">
<field name="name">product.product.view.form.easy.inherit.stock.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="stock.product_product_view_form_easy_inherit_stock"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_update_quantity_on_hand' and @type='object' and @string='Update Quantity']" position="attributes">
<attribute name="groups">base.group_erp_manager</attribute>
</xpath>
</field>
</record>
</odoo>