Skip to content

[19.0][FIX] dms: allow saving subdirectories when created from parent context - #522

Closed
miraaz wants to merge 1 commit into
OCA:19.0from
miraaz:19.0-fix-subdirectory-parent-id
Closed

miraaz wants to merge 1 commit into
OCA:19.0from
miraaz:19.0-fix-subdirectory-parent-id

Conversation

@miraaz

@miraaz miraaz commented Oct 8, 2026

Copy link
Copy Markdown

Bug Description

When creating a new subdirectory from an existing directory's form view (Subdirectories tab -> Add a line), the web client (OWL) marks the Parent Directory field as missing (Missing required fields), blocking the save.

Although context provides default_parent_id (as seen in complete_name), the user is forced to manually re-select the parent directory from the dropdown list.

Solution

Allow parent_id to be hidden and bypass strict client-side requirement when default_parent_id is present in context:

  • invisible="is_root_directory or context.get('default_parent_id')"
  • required="not is_root_directory and not context.get('default_parent_id')"

@ajimenez-pyming ajimenez-pyming left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@SirPyTech SirPyTech left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!
The parent_id should be populated in the new record because of the context default_parent_id.
The exact same mechanism is used in ir.ui.menu and works fine, so I think there is something in parent_id's compute or default or somewhere else that breaks it.
If this mechanism does not work here (it works fine in 18.0), then it should be fixed.
Have you investigated more deeply on why this isn't happening?

This said, the work-around works well and fixes the issue.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@victoralmau victoralmau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this change is incorrect; it needs to be corrected so that default_parent_id is defined correctly in the form view of the new directory you want to create.

I need to analyze this more thoroughly to propose the appropriate solution.

@victoralmau

Copy link
Copy Markdown
Member

#527

@SirPyTech

Copy link
Copy Markdown
Contributor

@miraaz please close this because it has already been fixed by #527

@pedrobaeza pedrobaeza closed this Oct 21, 2026
@miraaz
miraaz deleted the 19.0-fix-subdirectory-parent-id branch October 23, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants