[18.0][FIX] dms: unique names for record directories of records sharing a display name #539
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.73 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
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.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
pedrobaeza
marlon-costa-dc
Problem
A storage with
save_type=attachmentcreates one directory per record (ir.attachment._dms_directories_create), named afterdisplay_name. When two records have the same display name (for example two partners called the same), creating an attachment on the second one raisesValidationError: A directory with the same name already exists.The
check_name=Falsecontext 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
dmswith demo data; the demo has a storage linked tores.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>)fromdms/tools/file.py, the helper the module already uses for files.Tests
New
test_storage_attachment_same_record_name: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.