[18.0][FIX] dms_field: make template root directory creation idempotent - #501
Open
DealTechSrl wants to merge 2 commits into
Open
[18.0][FIX] dms_field: make template root directory creation idempotent#501DealTechSrl wants to merge 2 commits into
DealTechSrl wants to merge 2 commits into
Conversation
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.
Contributor
|
Hi @CarlosRoca13, |
Member
|
In my opinion, the best solution would be not to display the button to create the directory if it already exists. |
Author
|
The PR fix problems due to recursive call of create_dms_directory() made by py and js. Yes, hide the button when directory already exists can be an addition festure to add. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #500
Changed files:
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.