← Back to Pull requests

[18.0][FIX] dms_field: make template root directory creation idempotent #501

Open
DealTechSrl opened this pull request with 116 lines diff across 1 files
View on GitHub
DealTechSrl DealTechSrl commented on Aug 06, 2026 09:56 UTC
Author

Issue: https://github.com/OCA/dms/issues/500
Changed files:

  • dms_field/models/dms_field_template.py

  • dms_field/static/src/views/dms_list/dms_list_controller.esm.js
  • Root cause:
    When initializing the Documents tab of a dms.field.template, the backend created the template root directory, but repeated calls to create_dms_directory() could try to create the same root again, causing:

    "A directory with the same name already exists."

    The created directory could also be missing template access groups, making it invisible to regular users. On the frontend, the DMS widget relied on cached dms_directory_ids, so a newly created template root directory could exist in the database but not appear immediately in the tree.

    Solution:
    Make dms.field.template root directory creation idempotent, keep access groups aligned with the template, and adjust the widget domain so the created root can be displayed after refresh.

    Diff: 116 lines (+87 / -29) across 1 files Reviewer: None requested Review duration: 171128m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.50) × (1 − Review Confidence (0.42)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 116 lines diff across 1 files
    0.50
    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: 10%
    42%
    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.285
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #501"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    DealTechSrl DealTechSrl
    Labels
    risk: low confidence: 42.2% 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: 50.5% (MEDIUM) · Higher = larger blast radius
    50.5%
    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: 42.2% · Lower = rushed or shallow review
    42.2%
    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: 29.2% · Safe to merge
    29.2%
    Repository