← Back to Pull requests

[18.0][FIX] printer_zpl2: do not require access on ir.model #496

Open
unknown opened this pull request with 169 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 30, 2026 07:25 UTC
Author

Port of #353 (16.0) to 18.0, extended to the print label wizard.

Problem: since 17.0, only Access Rights administrators (base.group_erp_manager) can read ir.model. Every internal user is a Print User (base.group_user implies printing_group_user), but printing a ZPL2 label as an internal user who is not an administrator fails with

AccessError: You are not allowed to access 'Models' (ir.model) records.

in three places:

  • the wizard's default_get searches labels on model_id.model, so the wizard can't even open;

  • the domain of the wizard's label_id field uses the same model_id.model path, so the label dropdown fails too;

  • printing.label.zpl2.print_label reads label.model_id.model (the part fixed in 16.0 by #353).
  • Fix:

  • print_label: read the model with sudo(), as in #353.

  • wizard: filter labels on model_id with ir.model._get_id(active_model), which doesn't need access to ir.model.
  • Test: test_print_record_label_internal_user goes through the wizard as an internal user: the label domain, the wizard creation (default values) and the printing (cups patched). Without the fix it fails with the AccessError above (domain search); with only the wizard part it still fails in print_label. With the fix, all the module's tests pass (48 tests on Odoo 18.0).

    Assisted-by: Claude Opus 5.5

    Diff: 169 lines (+126 / -43) across 2 files Reviewer: MiquelRForgeFlow Review duration: 33885m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 169 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.307
    Real PR Conversation Timeline
    1 comments
    "Review active on #496"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.2% (MEDIUM) · Higher = larger blast radius
    35.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.8% · Safe to merge
    18.8%