← Back to Pull requests

[19.0][FIX] dms: record directories of records sharing a display name get unique names #542

Open
victoralmau opened this pull request with 19 lines diff across 2 files
View on GitHub
victoralmau victoralmau commented on Nov 13, 2026 07:32 UTC
Author

FWP from 18.0: https://github.com/OCA/dms/pull/539

Problem


A storage with save_type=attachment creates one directory per record (ir.attachment._dms_directories_create), named after display_name. When two records have the same display name (for example two partners called the same), creating an attachment on the second one raises ValidationError: A directory with the same name already exists.

The check_name=False context only skips the character check, not the uniqueness check. This blocks any write that creates an attachment, for example creating a company whose partner has the same name as another partner.

How to reproduce


1. Install dms with demo data; the demo has a storage linked to res.partner.
2. Create an attachment on a partner.
3. Copy that partner keeping its name, then create an attachment on the copy.
4. The ValidationError is raised.

Fix


The auto-created directory now gets unique_name(display_name, <sibling names>) from dms/tools/file.py, the helper the module already uses for files.

Tests


New test_storage_attachment_same_record_name:
  • without the fix: ERROR, 1 of 70 dms tests;

  • with the fix: 0 failed, 0 errors, 74 tests (all dms tests, including the portal tours).

  • Run on Odoo 18.0 in a database with only dms and its dependencies.

    CLA


    The author signed the OCA CLA; the commit email (marlon.costa@datacosmos.com.br) is now verified on the GitHub account marlon-costa-dc.

    @Tecnativa

    Diff: 19 lines (+18 / -1) across 2 files Reviewer: None requested Review duration: 28712m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.34) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.34 · 19 lines diff across 2 files
    0.34
    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%
    44%
    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.179
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #542"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    victoralmau victoralmau
    Labels
    risk: low confidence: 44.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: 34.4% (LOW) · Higher = larger blast radius
    34.4%
    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: 44.2% · Lower = rushed or shallow review
    44.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: 19.2% · Safe to merge
    19.2%
    Repository