refactor: restrict Send RFQ visibility by removing Confirm Order button suppression logic

This commit is contained in:
Suherdy Yacob 2026-06-03 10:20:51 +07:00
parent 2db9ad7d44
commit 55970ab1f8
3 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@ Custom Odoo 19 module to dynamically manage the visibility of buttons and financ
## Features
- Per-User Restricting Options: Toggle restriction flags directly on individual user accounts.
- Hide RFQ & Confirmation Buttons: Hide "Confirm Order" and "Send RFQ" buttons from the purchase order header for restricted users.
- Hide RFQ Button: Hide "Send RFQ" button from the purchase order header for restricted users.
- Hide Financial Fields: Hide unit price, subtotal, and totals on purchase lists, forms, line kanbans, and footer groups for restricted users.
- Flexible and Stateless: Instant dynamically computed restrictions without storing redundant data in the database.
@ -17,7 +17,7 @@ Custom Odoo 19 module to dynamically manage the visibility of buttons and financ
1. Go to Settings -> Users & Companies -> Users.
2. Select a User record and click Edit.
3. Open the Purchase Restrictions tab.
4. Check the desired restrictions (Hide Confirm Order & Send RFQ, Hide Price, Subtotal & Total).
4. Check the desired restrictions (Hide Send RFQ, Hide Price, Subtotal & Total).
5. Save the user record.
## Author

View File

@ -49,9 +49,9 @@ class PurchaseOrder(models.Model):
modified = False
# 1. Dynamically hide Confirm Order and Send RFQ buttons
# 1. Dynamically hide Send RFQ button
if hide_buttons:
for btn in doc.xpath("//button[@name='action_rfq_send' or @name='button_confirm']"):
for btn in doc.xpath("//button[@name='action_rfq_send']"):
btn.set('invisible', '1')
modified = True

View File

@ -5,8 +5,8 @@ class ResUsers(models.Model):
_inherit = 'res.users'
hide_confirm_order_send_rfq = fields.Boolean(
string="Hide Confirm Order & Send RFQ",
help="Hide Confirm Order and Send RFQ buttons on Purchase Order form for this user."
string="Hide Send RFQ",
help="Hide Send RFQ button on Purchase Order form for this user."
)
hide_purchase_prices = fields.Boolean(