[16.0][ADD] project_state_extend: add new module#1586
[16.0][ADD] project_state_extend: add new module#1586
Conversation
c88850b to
78dbd15
Compare
|
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. |
alexey-pelykh
left a comment
There was a problem hiding this comment.
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.
78dbd15 to
51de852
Compare
51de852 to
a173db0
Compare
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks @kaynnan — excellent work addressing all the feedback. Re-reviewing after the update:
-
Wrong native color values — ✅ Now imports
STATUS_COLORfromodoo.addons.project.models.project_updateviastatus_utils.py. No more hardcoded values. -
Duplicated logic — ✅ Factored into shared
get_extended_status_selection()andget_extended_status_color()instatus_utils.py. -
Blanket
eslint-disable— ✅ Removed. Clean JS with proper OWL patches. -
No validation on
technical_name— ✅@api.constrainswith regex^[a-z][a-z0-9_]*$+ collision check againstNATIVE_STATUS_KEYS+ SQL unique constraint. -
Data integrity on delete — ✅
unlink()override checks projects and updates before allowing deletion. -
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
|
This PR has the |
|
/ocabot merge nobump |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
@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. |
|
There are errors while trying to merge @kaynnan , could you have a look at them? |
Add
project_state_extendmodule to allow custom project states beyond Odoo's native ones.Technical Details
project.state.extendfor state managementDemo States Included
cc @marcelsavegnago @WesleyOliveira98 @CristianoMafraJunior