Skip to content

[18.0][FIX] agreement: open partner agreements as a non-admin user - #131

Open
ROBBYHOOD9 wants to merge 1 commit into
OCA:18.0from
ecosoft-odoo:18.0-fix-agreement-action-open-agreement-acl
Open

[18.0][FIX] agreement: open partner agreements as a non-admin user#131
ROBBYHOOD9 wants to merge 1 commit into
OCA:18.0from
ecosoft-odoo:18.0-fix-agreement-action-open-agreement-acl

Conversation

@ROBBYHOOD9

Copy link
Copy Markdown
Contributor

Steps to error

  1. Install agreement with demo data.
  2. Log in as an Internal User who is not in Administration/Settings, e.g. demo.
SCR-20260827-txvt
  1. Open the Contact form for base.res_partner_12, which has an Agreement.
  2. Click the Agreements stat button.
SCR-20260827-udnh
  1. An Access Error is raised.
SCR-20260827-udab

Root cause

The existing code uses action.read()[0], which reads the Action with the current user's permissions. However, the core ACL for this model only allows group_system, causing an Access Error for regular users.

Fix

Use _for_xml_id() instead, which handles reading the Action with sudo and returns only the fields required by the web client. This is preferred over sudo().read()[0] to avoid granting or reading more data than necessary.

`action_open_agreement` read the action record as the current user, but
`ir.actions.act_window` is only readable by the Settings group
(`base.group_system`). Any other user clicking the "Agreements" stat
button on a partner form got:

    You are not allowed to access 'Action Window' (ir.actions.act_window)
    records.

Fetch the action through `ir.actions.act_window._for_xml_id()`, which
reads it with superuser rights and returns only the fields the web client
needs.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @ygol, @alexis-via,
some modules you are maintaining are being modified, check this out!

@ROBBYHOOD9 ROBBYHOOD9 changed the title [FIX] agreement: open partner agreements as a non-admin user [18.0][FIX] agreement: open partner agreements as a non-admin user Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants