Skip to content

[IMP] dms: Add Category/Directory Code - #525

Open
SirPyTech wants to merge 2 commits into
OCA:18.0from
PyTech-SRL:18.0-imp-dms-add_code_complete_name
Open

SirPyTech wants to merge 2 commits into
OCA:18.0from
PyTech-SRL:18.0-imp-dms-add_code_complete_name

Conversation

@SirPyTech

Copy link
Copy Markdown

Add a "Code" field to categories and directories, that is used to compute their complete name as [code] name.
If the new code field is left empty, the behavior remains as it was before this PR.

Comment thread dms/models/directory.py
Comment on lines -387 to +388
for category in self:
if category.parent_id:
category.complete_name = (
f"{category.parent_id.complete_name} / {category.name}"
for directory in self:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Here I also renamed from category to directory because we are in the Directory model, category was probably coming from a copy/paste

name="name"
filter_domain="['|', ('name', 'ilike', self), ('parent_id', 'child_of', raw_value)]"
/>
<field name="complete_name" />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If I understand the old filter correctly, complete_name does the same thing and is more aligned with directories' search

Comment on lines +430 to +433
<label for="code" class="oe_edit_only" />
<h3>
<field name="code" />
</h3>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is how it shows: Image

I'm not sure oe_edit_only does anything, but I added it because it's there for name too.

Comment on lines +55 to +58
<label for="code" class="oe_edit_only" />
<h3>
<field name="code" />
</h3>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is how it shows: Image

I'm not sure oe_edit_only does anything, but I added it because it's there for name too.

@SirPyTech
SirPyTech marked this pull request as ready for review October 14, 2026 08:38
@SirPyTech
SirPyTech force-pushed the 18.0-imp-dms-add_code_complete_name branch from a2c04ca to 5dc05fc Compare October 14, 2026 13:19

@HekkiMelody HekkiMelody 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.

Code and functional review, LGTM

Comment thread dms/models/directory.py
@SirPyTech
SirPyTech force-pushed the 18.0-imp-dms-add_code_complete_name branch from 5dc05fc to 10e777f Compare October 15, 2026 13:52
@SirPyTech
SirPyTech requested a review from HekkiMelody October 15, 2026 13:54
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.

3 participants