Conversation
99a2b00 to
4726758
Compare
4726758 to
4367a80
Compare
EmilioPascual
left a comment
There was a problem hiding this comment.
Good job @Shide. Just minor change, although the module works fine anyway.
Gelojr
left a comment
There was a problem hiding this comment.
Congrats on the work @Shide
The following tests have been performed (limited to the basic scenario only, because it’s not possible to manually modify the “Last Stage Update” field in the UI).
Test 1: Basic auto-state change by stage (cron runs and updates tasks) — OK
|
This PR has the |
c2d0653 to
5665406
Compare
|
Now you MUST select states that will trigger the auto-done/cancel when the days has been reached. See description |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for this module @Shide -- nice concept and clean implementation overall. A few things to address before merging:
Bug: wrong state value for "Waiting"
The _get_auto_x_allowed_states method appends "04_waiting" but the actual Odoo 18 task state is "04_waiting_normal". This means enabling "Allow Done/Cancel from Waiting" will silently never match any task. Should be "04_waiting_normal".
Unused import
logging and _logger are imported in project_task.py but never used. Remove them to keep linting clean.
CI note
The test failures are from sale_project_task_selection, unrelated to this module.
Minor: performance consideration
The cron iterates stages and calls self.search() per stage, then task.write() + task.message_post() per task. Fine for typical volumes, but if you want to future-proof it, batching the write (single tasks.write(...) per stage) would reduce DB round-trips. The message_post still needs per-task, so this is purely optional.
alexey-pelykh
left a comment
There was a problem hiding this comment.
Supplementary review -- a few additional observations beyond my earlier CHANGES_REQUESTED review.
Negative days values
auto_done_days and auto_cancel_days are fields.Integer with no constraint preventing negative values. A negative value would produce a threshold_date in the future, meaning the cron would never match anything (harmless) but the configuration would be silently misleading. Consider adding @api.constrains to enforce >= 0, or switching to a field with a built-in minimum.
Missing test coverage for non-in_progress states
All current tests only exercise the in_progress -> done/cancel path. There is no test for changes_requested, approved, or waiting transitions. A test for the waiting state specifically would have caught the "04_waiting" vs "04_waiting_normal" bug flagged in my earlier review. I would recommend adding at least one test per allowed state to ensure the state mapping is correct end-to-end.
freezegun not declared as external dependency
freezegun is used in tests but is not listed in __manifest__.py under external_dependencies. While it is commonly available in OCA CI environments, declaring it is cleaner:
"external_dependencies": {
"python": ["freezegun"],
},Everything else looks solid
- Module structure follows OCA conventions (manifest, readme fragments, i18n, tests).
- Cron definition with
noupdate="1"is correct. - Validation constraints on stages (requiring at least one allowed state) are well implemented.
- Spanish translations are complete and accurate.
- View inheritance using xpath is clean and follows Odoo best practices.
- The
message_postwithsubtype_xmlid="mail.mt_note"is the right choice for internal notifications.
Review posted via CorporateHub OCA review campaign
5665406 to
21ad3a7
Compare
Automatically change task state (done or canceled) after they remain in a stage for a
configured number of days.
Key features:
Images:

MT-13537 @moduon @Gelojr @rafaelbn @fcvalgar please review if you want 😄