Skip to content

[16.0][ADD] project_state_extend: add new module#1586

Open
kaynnan wants to merge 1 commit intoOCA:16.0from
Escodoo:16.0-add-project_state_extend
Open

[16.0][ADD] project_state_extend: add new module#1586
kaynnan wants to merge 1 commit intoOCA:16.0from
Escodoo:16.0-add-project_state_extend

Conversation

@kaynnan
Copy link
Copy Markdown

@kaynnan kaynnan commented Oct 16, 2025

Add project_state_extend module to allow custom project states beyond Odoo's native ones.

Technical Details

  • New model project.state.extend for state management
  • ES6 service to load states from database
  • Patches native Odoo widgets to include custom states

Demo States Included

  • Pending Review, Awaiting Approval, In Progress, Blocked, Completed

cc @marcelsavegnago @WesleyOliveira98 @CristianoMafraJunior

@kaynnan kaynnan force-pushed the 16.0-add-project_state_extend branch 4 times, most recently from c88850b to 78dbd15 Compare October 16, 2025 21:56
@kaynnan kaynnan marked this pull request as ready for review October 16, 2025 22:01
Copy link
Copy Markdown
Member

@CristianoMafraJunior CristianoMafraJunior left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 15, 2026
Copy link
Copy Markdown
Contributor

@alexey-pelykh alexey-pelykh left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @kaynnan. The idea of extending project states is useful, but there are several issues that need to be addressed.

Wrong native color values

In both project_project.py and project_update.py, the hardcoded color dicts have incorrect values compared to Odoo's actual STATUS_COLOR:

Status Your value Odoo native
on_track 10 20
off_track 1 23

Also missing False: 0 fallback. Import and reuse STATUS_COLOR from odoo.addons.project.models.project_update rather than re-declaring.

Duplicated logic

_get_extended_status_selection() and _compute_*_color() are copy-pasted between project_project.py and project_update.py with minor differences. Factor into a shared helper.

/* eslint-disable */ blanket

The JS file has a blanket eslint disable. Use targeted directives instead.

No validation on technical_name

No @api.constrains to enforce lowercase, no-spaces, and no collision with native state keys (on_track, at_risk, off_track, on_hold, to_define). A user creating technical_name = "on_track" would shadow the native state.

Data integrity on delete

If a custom state is deleted while still assigned to projects/updates, those records will have invalid last_update_status/status values. Consider preventing deletion of in-use states.

Documentation mentions Tasks but module doesn't extend tasks

USAGE.rst says "Projects and Tasks" but the module only extends project.project and project.update.

Happy to re-review once addressed.

Comment thread project_state_extend/models/project_project.py Outdated
Comment thread project_state_extend/models/project_update.py Outdated
Comment thread project_state_extend/models/project_state_extend.py
Comment thread project_state_extend/readme/USAGE.rst Outdated
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 1, 2026
@kaynnan kaynnan force-pushed the 16.0-add-project_state_extend branch from 78dbd15 to 51de852 Compare March 1, 2026 14:52
@kaynnan kaynnan requested a review from alexey-pelykh March 1, 2026 14:53
@kaynnan kaynnan force-pushed the 16.0-add-project_state_extend branch from 51de852 to a173db0 Compare March 1, 2026 15:05
Copy link
Copy Markdown
Contributor

@alexey-pelykh alexey-pelykh left a comment

Choose a reason for hiding this comment

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

Thanks @kaynnan — excellent work addressing all the feedback. Re-reviewing after the update:

  1. Wrong native color values — ✅ Now imports STATUS_COLOR from odoo.addons.project.models.project_update via status_utils.py. No more hardcoded values.

  2. Duplicated logic — ✅ Factored into shared get_extended_status_selection() and get_extended_status_color() in status_utils.py.

  3. Blanket eslint-disable — ✅ Removed. Clean JS with proper OWL patches.

  4. No validation on technical_name — ✅ @api.constrains with regex ^[a-z][a-z0-9_]*$ + collision check against NATIVE_STATUS_KEYS + SQL unique constraint.

  5. Data integrity on delete — ✅ unlink() override checks projects and updates before allowing deletion.

  6. Documentation scope — ✅ USAGE.rst now correctly scoped to Projects only.

All CI green. Well done on the thorough rework.

Co-Reviewed-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@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). 🤖

Copy link
Copy Markdown
Member

@marcelsavegnago marcelsavegnago left a comment

Choose a reason for hiding this comment

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

LGTM

@leemannd
Copy link
Copy Markdown
Contributor

leemannd commented May 4, 2026

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-1586-by-leemannd-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

@leemannd your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-1586-by-leemannd-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@leemannd
Copy link
Copy Markdown
Contributor

leemannd commented May 4, 2026

There are errors while trying to merge @kaynnan , could you have a look at them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants