fix: comprehensive permission overhaul for fusion_faxes and fusion_ringcentral

Users without fax/RC groups could not open Sale Orders, Invoices, or
Contacts because the One2many computed fields triggered AccessError
on fusion.fax. Now base.group_user gets read-only access so computed
fields work silently, while all UI elements (smart buttons, header
buttons, menus, partner fields, settings) are restricted to the
proper security groups. Both modules now use Odoo 19 privilege
pattern for the user settings dropdown.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gsinghpal
2026-02-25 11:52:06 -05:00
parent e71bc503f9
commit 34e5b46025
11 changed files with 112 additions and 38 deletions

View File

@@ -1,8 +1,10 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_fusion_fax_base,fusion.fax.base.read,model_fusion_fax,base.group_user,1,0,0,0
access_fusion_fax_user,fusion.fax.user,model_fusion_fax,group_fax_user,1,1,1,0
access_fusion_fax_manager,fusion.fax.manager,model_fusion_fax,group_fax_manager,1,1,1,1
access_fusion_send_fax_wizard_user,fusion.send.fax.wizard.user,model_fusion_faxes_send_fax_wizard,group_fax_user,1,1,1,1
access_fusion_send_fax_wizard_line_user,fusion.send.fax.wizard.line.user,model_fusion_faxes_send_fax_wizard_line,group_fax_user,1,1,1,1
access_fusion_fax_document_base,fusion.fax.document.base.read,model_fusion_fax_document,base.group_user,1,0,0,0
access_fusion_fax_document_user,fusion.fax.document.user,model_fusion_fax_document,group_fax_user,1,1,1,0
access_fusion_fax_document_manager,fusion.fax.document.manager,model_fusion_fax_document,group_fax_manager,1,1,1,1
access_fusion_fax_dashboard_user,fusion.fax.dashboard.user,model_fusion_fax_dashboard,group_fax_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_fusion_fax_base fusion.fax.base.read model_fusion_fax base.group_user 1 0 0 0
3 access_fusion_fax_user fusion.fax.user model_fusion_fax group_fax_user 1 1 1 0
4 access_fusion_fax_manager fusion.fax.manager model_fusion_fax group_fax_manager 1 1 1 1
5 access_fusion_send_fax_wizard_user fusion.send.fax.wizard.user model_fusion_faxes_send_fax_wizard group_fax_user 1 1 1 1
6 access_fusion_send_fax_wizard_line_user fusion.send.fax.wizard.line.user model_fusion_faxes_send_fax_wizard_line group_fax_user 1 1 1 1
7 access_fusion_fax_document_base fusion.fax.document.base.read model_fusion_fax_document base.group_user 1 0 0 0
8 access_fusion_fax_document_user fusion.fax.document.user model_fusion_fax_document group_fax_user 1 1 1 0
9 access_fusion_fax_document_manager fusion.fax.document.manager model_fusion_fax_document group_fax_manager 1 1 1 1
10 access_fusion_fax_dashboard_user fusion.fax.dashboard.user model_fusion_fax_dashboard group_fax_user 1 1 1 1

View File

@@ -1,22 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Module category (appears in Settings > Users) -->
<record id="module_category_fusion_faxes" model="ir.module.category">
<field name="name">Fusion Faxes</field>
<field name="sequence">47</field>
</record>
<!-- Privilege (Odoo 19 user settings dropdown) -->
<record id="res_groups_privilege_fusion_faxes" model="res.groups.privilege">
<field name="name">Fusion Faxes</field>
<field name="sequence">47</field>
<field name="category_id" ref="module_category_fusion_faxes"/>
</record>
<!-- User group: can send faxes and view own fax history -->
<record id="group_fax_user" model="res.groups">
<field name="name">User</field>
<field name="sequence">10</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="privilege_id" ref="res_groups_privilege_fusion_faxes"/>
</record>
<!-- Manager group: can view all faxes and configure settings -->
<record id="group_fax_manager" model="res.groups">
<field name="name">Manager</field>
<field name="sequence">20</field>
<field name="implied_ids" eval="[(4, ref('group_fax_user'))]"/>
<field name="privilege_id" ref="res_groups_privilege_fusion_faxes"/>
<field name="user_ids" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
<data noupdate="0">
<!-- User group: can send faxes and view own fax history -->
<record id="group_fax_user" model="res.groups">
<field name="name">Fusion Faxes / User</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<!-- Base users can read fax records (needed for One2many computed fields on sale.order etc.) -->
<record id="rule_fax_base_read" model="ir.rule">
<field name="name">Fax: all internal users read-only</field>
<field name="model_id" ref="model_fusion_fax"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
<!-- Manager group: can view all faxes and configure settings -->
<record id="group_fax_manager" model="res.groups">
<field name="name">Fusion Faxes / Manager</field>
<field name="implied_ids" eval="[(4, ref('group_fax_user'))]"/>
</record>
<!-- Record rules -->
<!-- Users see only their own faxes -->
<!-- Fax users see only their own faxes (full CRUD minus unlink) -->
<record id="rule_fax_user_own" model="ir.rule">
<field name="name">Fax: user sees own faxes</field>
<field name="model_id" ref="model_fusion_fax"/>

View File

@@ -8,16 +8,17 @@
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<!-- Smart button for fax count -->
<!-- Smart button for fax count (fax users only) -->
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_view_faxes" type="object"
class="oe_stat_button" icon="fa-fax"
invisible="x_ff_fax_count == 0">
invisible="x_ff_fax_count == 0"
groups="fusion_faxes.group_fax_user">
<field name="x_ff_fax_count" widget="statinfo" string="Faxes"/>
</button>
</xpath>
<!-- Send Fax header button -->
<!-- Send Fax header button (fax users only) -->
<xpath expr="//header" position="inside">
<button name="action_send_fax" string="Send Fax"
type="object" class="btn-secondary"

View File

@@ -232,10 +232,11 @@
<field name="search_view_id" ref="view_fusion_fax_search"/>
</record>
<!-- Top-level Faxes menu -->
<!-- Top-level Faxes menu (fax users only) -->
<menuitem id="menu_fusion_faxes_root"
name="Faxes"
web_icon="fusion_faxes,static/description/icon.png"
groups="group_fax_user"
sequence="45"/>
<menuitem id="menu_fusion_fax_list"

View File

@@ -8,28 +8,31 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<!-- Add fax number on its own row below phone -->
<!-- Add fax number on its own row below phone (fax users only) -->
<xpath expr="//field[@name='phone']/.." position="after">
<div class="d-flex align-items-baseline w-md-50">
<div class="d-flex align-items-baseline w-md-50"
groups="fusion_faxes.group_fax_user">
<i class="fa fa-fw me-1 fa-fax text-primary" title="Fax"/>
<field name="x_ff_fax_number" class="w-100" widget="phone"
placeholder="Fax number..."/>
</div>
</xpath>
<!-- Add smart button for fax count -->
<!-- Add smart button for fax count (fax users only) -->
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_view_faxes" type="object"
class="oe_stat_button" icon="fa-fax"
invisible="x_ff_fax_count == 0">
invisible="x_ff_fax_count == 0"
groups="fusion_faxes.group_fax_user">
<field name="x_ff_fax_count" widget="statinfo" string="Faxes"/>
</button>
</xpath>
<!-- Add Fax History tab -->
<!-- Add Fax History tab (fax users only) -->
<xpath expr="//page[@name='internal_notes']" position="after">
<page string="Fax History" name="fax_history"
invisible="x_ff_fax_count == 0">
invisible="x_ff_fax_count == 0"
groups="fusion_faxes.group_fax_user">
<field name="x_ff_fax_ids" readonly="1">
<list>
<field name="name"/>

View File

@@ -8,16 +8,17 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<!-- Smart button for fax count -->
<!-- Smart button for fax count (fax users only) -->
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_view_faxes" type="object"
class="oe_stat_button" icon="fa-fax"
invisible="x_ff_fax_count == 0">
invisible="x_ff_fax_count == 0"
groups="fusion_faxes.group_fax_user">
<field name="x_ff_fax_count" widget="statinfo" string="Faxes"/>
</button>
</xpath>
<!-- Send Fax header button -->
<!-- Send Fax header button (fax users only) -->
<xpath expr="//header" position="inside">
<button name="action_send_fax" string="Send Fax"
type="object" class="btn-secondary"