diff --git a/README.md b/README.md
index 7a6d9fb..dc48563 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Restrict visibility of the following records based on User configuration:
* **Locations** (`stock.location`)
* **Work Centers** (`mrp.workcenter`)
* **Approval Categories** (`approval.category`)
-* **Quality Checks Button** (on Manufacturing Orders)
+* **Quality Checks Button** (on Manufacturing Orders and Inventory Transfers)
## Configuration
@@ -32,12 +32,13 @@ Restrict visibility of the following records based on User configuration:
## Quality Checks Button Restriction
-The "Quality Checks" button on Manufacturing Orders is automatically hidden for users who belong to the following groups:
-* **Inventory User**
-* **Manufacturing User**
-* **MPS User**
+The visibility of the "Quality Checks" and "Quality Alert" buttons on **Manufacturing Orders** and **Inventory Transfers** is controlled by a specific user setting.
-**Exception**: If a user in these groups is *also* assigned the **Quality User** or **Quality Manager** role, the button will remain visible.
+To allow a user to see these buttons:
+1. Navigate to **Settings > Users & Companies > Users**.
+2. Enable the checkbox **"Is Allowed todo Quality Checks?"** in the **Access Restrictions** tab.
+
+By default, this setting is unchecked, meaning users will **NOT** see these buttons unless explicitly allowed.
## Technical Details
diff --git a/__manifest__.py b/__manifest__.py
index 8fffbb9..cc224c6 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -16,12 +16,13 @@
""",
'category': 'Extra Tools',
'author': 'Suherdy Yacob',
- 'depends': ['base', 'stock', 'mrp', 'approvals', 'stock_account', 'sale'],
+ 'depends': ['base', 'stock', 'mrp', 'approvals', 'stock_account', 'sale', 'quality_mrp'],
'data': [
'security/ir.model.access.csv',
'security/ir_rule.xml',
'security/ir_actions_act_window.xml',
'views/res_users_views.xml',
+ 'views/mrp_production_views.xml',
],
'installable': True,
'application': False,
diff --git a/models/__init__.py b/models/__init__.py
index b7e89d9..867dcf2 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -6,4 +6,5 @@ from . import stock_picking
=======
>>>>>>> 3a96e90 (feat: Hide quality check buttons on manufacturing orders for specific user groups with exceptions for quality roles.)
from . import mrp_production
+from . import stock_picking
diff --git a/models/__pycache__/res_users.cpython-312.pyc b/models/__pycache__/res_users.cpython-312.pyc
index 620603c..b7feec6 100644
Binary files a/models/__pycache__/res_users.cpython-312.pyc and b/models/__pycache__/res_users.cpython-312.pyc differ
diff --git a/models/mrp_production.py b/models/mrp_production.py
index 9a60cb7..97a2e08 100644
--- a/models/mrp_production.py
+++ b/models/mrp_production.py
@@ -26,9 +26,11 @@ class MrpProduction(models.Model):
=======
hide_quality_check_button = fields.Boolean(compute='_compute_hide_quality_check_button')
+ @api.depends('product_id')
@api.depends_context('uid')
def _compute_hide_quality_check_button(self):
for record in self:
+<<<<<<< HEAD
user = self.env.user
# Define the restricted groups
@@ -83,3 +85,9 @@ class MrpProduction(models.Model):
else:
record.hide_quality_check_button = False
>>>>>>> 3a96e90 (feat: Hide quality check buttons on manufacturing orders for specific user groups with exceptions for quality roles.)
+=======
+ # Logic: Hide logic is inverse of "is allowed"
+ # If allowed_quality_checks is True, hide = False
+ # If allowed_quality_checks is False, hide = True
+ record.hide_quality_check_button = not self.env.user.allowed_quality_checks
+>>>>>>> 4a049d1 (feat: Implement user-specific control for quality check button visibility on manufacturing orders and inventory transfers via a new `allowed_quality_checks` field on users.)
diff --git a/models/res_users.py b/models/res_users.py
index a50010c..1b3c7d7 100644
--- a/models/res_users.py
+++ b/models/res_users.py
@@ -47,3 +47,9 @@ class ResUsers(models.Model):
string="Allowed Approvals",
help="Approval Categories this user is allowed to access. Leave empty to restrict access to none."
)
+
+ allowed_quality_checks = fields.Boolean(
+ string="Is Allowed todo Quality Checks?",
+ default=False,
+ help="If checked, this user can see the Quality Checks button on Manufacturing Orders."
+ )
diff --git a/models/stock_picking.py b/models/stock_picking.py
index ff34b74..7538df2 100644
--- a/models/stock_picking.py
+++ b/models/stock_picking.py
@@ -3,6 +3,7 @@ from odoo import models, fields, api
class StockPicking(models.Model):
_inherit = 'stock.picking'
+<<<<<<< HEAD
restrict_quality_check_button = fields.Boolean(compute='_compute_restrict_quality_check_button')
@api.depends_context('uid')
@@ -32,3 +33,12 @@ class StockPicking(models.Model):
picking.restrict_quality_check_button = True
else:
picking.restrict_quality_check_button = False
+=======
+ hide_quality_check_button = fields.Boolean(compute='_compute_hide_quality_check_button')
+
+ @api.depends('picking_type_id')
+ @api.depends_context('uid')
+ def _compute_hide_quality_check_button(self):
+ for record in self:
+ record.hide_quality_check_button = not self.env.user.allowed_quality_checks
+>>>>>>> 4a049d1 (feat: Implement user-specific control for quality check button visibility on manufacturing orders and inventory transfers via a new `allowed_quality_checks` field on users.)
diff --git a/views/mrp_production_views.xml b/views/mrp_production_views.xml
index eb291bb..b7194e2 100644
--- a/views/mrp_production_views.xml
+++ b/views/mrp_production_views.xml
@@ -8,8 +8,10 @@
>>>>>>> 3a96e90 (feat: Hide quality check buttons on manufacturing orders for specific user groups with exceptions for quality roles.)
mrp.production.view.form.inherit.access.restriction
mrp.production
-
+ 99999
+
+<<<<<<< HEAD
<<<<<<< HEAD
@@ -33,6 +35,9 @@
=======
+=======
+
+>>>>>>> 4a049d1 (feat: Implement user-specific control for quality check button visibility on manufacturing orders and inventory transfers via a new `allowed_quality_checks` field on users.)
diff --git a/views/res_users_views.xml b/views/res_users_views.xml
index 6ca0e38..59ab6d9 100644
--- a/views/res_users_views.xml
+++ b/views/res_users_views.xml
@@ -16,6 +16,7 @@
+
diff --git a/views/stock_picking_views.xml b/views/stock_picking_views.xml
index 4fe956a..f562e31 100644
--- a/views/stock_picking_views.xml
+++ b/views/stock_picking_views.xml
@@ -1,5 +1,6 @@
+<<<<<<< HEAD
@@ -32,6 +33,23 @@
not check_ids or not quality_check_fail or restrict_quality_check_button
+=======
+
+ stock.picking.view.form.inherit.access.restriction
+ stock.picking
+ 1000
+
+
+
+
+
+
+ hide_quality_check_button
+
+
+ hide_quality_check_button
+
+>>>>>>> 4a049d1 (feat: Implement user-specific control for quality check button visibility on manufacturing orders and inventory transfers via a new `allowed_quality_checks` field on users.)