← Back to Pull requests

[18.0][FIX] dms: unique names for record directories of records sharing a display name #539

Merged
marlon-costa-dc merged 2 files (21 lines) on Nov 13, 2026 07:14 UTC
View on GitHub
marlon-costa-dc marlon-costa-dc commented on Nov 08, 2026 05:19 UTC
Author

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.

    Diff: 21 lines (+20 / -1) across 2 files Reviewer: pedrobaeza Review duration: 7315m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.23) × (1 − Review Confidence (0.82)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.23 · 21 lines diff across 2 files
    0.23
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.73 · 1 substantive comment(s)
    0.73
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    81%
    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
    Diff Size diff_size
    0.185
    Real PR Conversation Timeline
    1 comments
    dms/tests/test_storage_attachment.py
    "Remove asserts not directly related to the test. ```suggestion self.assertEqual(directory.name, self.partner.display_name) self.assertNotEqual(twin_directory.name, directory.name) ```"
    test weight: 0.55
    Reviewers
    Assignees
    marlon-costa-dc marlon-costa-dc
    Labels
    risk: low confidence: 81.9% 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: 22.9% (LOW) · Higher = larger blast radius
    22.9%
    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: 81.9% · Lower = rushed or shallow review
    81.9%
    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: 4.2% · Safe to merge
    4.2%
    Repository