[19.0][FIX] stock_picking_invoice_link: restrict the invoice link to invoicing users #2442
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 331 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.347
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2442"
general
weight: 0.35
dreispt
Problem
A user with Inventory / User access and no accounting access cannot open an
internal transfer once this module is installed. The form fails with:
The picking form injects
invoice_ids(m2m toaccount.move) and the Invoicestat button with no
groups. Reading a many2many triggers a search on thecomodel, and warehouse profiles have no read access on
account.move, so anaccessory piece of information ends up blocking the core operation of the role.
The same happens on the stock.move form with
invoice_line_ids(
account.move.line).Why
groupson the field was not enoughinvoice_line_idsalready carriedgroups="account.group_account_invoice", butthe surrounding
<group>has aninvisible="invoice_line_ids == []"modifier.View postprocessing adds the field back as an invisible node so the modifier can
be evaluated:
so the field is read anyway and the form still breaks. The fix puts
groupsonthe node that carries the modifier, which removes both the modifier and the
field.
Change
views/stock_view.xmlonly:groups="account.group_account_invoice"on theinvoice_idsfield and on the stat button (the button holds the
invisible="invoice_count == 0"modifier, so it goes away with it);groupsmoved from theinvoice_line_idsfield to the enclosing<group name="invoice_line">.Nothing changes for users who can already see invoices.
Test plan
On a 19.0 database with this module installed, a user whose only groups are
base.group_user+stock.group_stock_user:picking.read(<fields exposed by stock.view_picking_form>)raisesAccessErroronaccount.move; the same onstock.view_move_formraises onaccount.move.line;invoice_ids/invoice_count/invoice_line_idsare no longerpresent in the arch returned by
get_view()for that user, and reading everyfield the forms expose succeeds;
account.group_account_invoicestill gets the stat button, theinvoice lines group and
invoice_count, and reaches the invoice from thepicking.
The list views (
stock.vpicktree,stock.view_move_tree) never exposed thesefields, and were verified not to raise for the restricted user.
The same asymmetry is present on 18.0; a backport can follow once this is
reviewed.