[19.0][MIG] project_template: Migration to 19.0#1617
[19.0][MIG] project_template: Migration to 19.0#1617Vang-NguyenPhu wants to merge 49 commits intoOCA:19.0from
Conversation
Adding new Project Template Module [FIX] PEP8 Errors Revert "[FIX] PEP8 Errors" This reverts commit 90f9cd9. [FIX] Fixed PEP8 Formatting First upload tests showed some lint issues which this commit has the fixes for. [FIX] Fixed LINT Issue Removed unreachable code that was not needed. [FIX] RunBot Warning Fixed runbot warning about @Class to hasclass [UPD] Suggested Changes Updated based on suggested changes on other submitted modules. [UPD] Manifest and Readme Updated Manifest and Readme based on comments on other module pr's. [UPD] Suggested Changes Updated code based on suggested code changes from reviewer. [FIX] Creation Error Fixed create project error when creating project via configuration/projects menu [UPD] Menu and Bool Change Removed Template Menu (Filter option still there) and moved Bool up below name. (From reviewer suggestions) [UPD] Kanban Menu Removed button, added link to kanban menu. Start of tests [UPD] Remove project_milestone code Removed the project_milestone code and will create a separate module for that purpose.
|
/ocabot migration project_template |
Quan-nhm
left a comment
There was a problem hiding this comment.
Functional Test and Code review LGTM!
|
This PR has the |
|
Hello @Vang-NguyenPhu could you quickly take the time to reduce a bit the administrative commits? https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests#mergesquash-the-commits-generated-by-bots-or-weblate |
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-12.0/project-12.0-project_template Translate-URL: https://translation.odoo-community.org/projects/project-12-0/project-12-0-project_template/
There is an error if the template name gets modified so needed to add a new else statement for the new_name.
Since in original odoo `15.0` version project subtasks has been deleted so changes also done in this module. We don't need project subtasks anymore because odoo don't have it.
Currently translated at 100.0% (10 of 10 strings) Translation: project-16.0/project-16.0-project_template Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_template/de/
Currently translated at 100.0% (7 of 7 strings) Translation: project-16.0/project-16.0-project_template Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_template/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-16.0/project-16.0-project_template Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_template/
Previously, if multiple tasks in a template project had the same name, their end_date-values were not copied properly. Co-authored-by: Stefan Rijnhart <stefan@opener.amsterdam>
* Change the way to copy end dates to tasks due to api change to _map_tasks_default_values which now longer gets passed the task * Refactor tests to use setUpClass (finally) * Update overwritten action context with upstream changes * Remove originally unmodified (but now outdated) fields from overwritten action * Update kanban element selector
29ba6ab to
6aecfce
Compare
All good now. |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for the migration work.
The main issue here is that Odoo 19.0 natively includes comprehensive project template support -- is_template field, action_create_from_template(), action_toggle_project_template_mode(), template ribbon, dedicated template views (form/list/kanban), and template filters in search. The native open_view_project_all action already uses domain=[("is_template", "=", False)] to exclude templates from the project list.
This module as-is conflicts with the native implementation in several ways:
-
Redundant
is_templatefield: Odoo 19.0 already definesis_template = fields.Boolean(copy=False)onproject.project. Re-declaring it in this module is harmless but pointless. -
Conflicting action window override: The module overrides
project.open_view_project_allto setsearch_default_projects: True, but the native action already uses a harddomain=[("is_template", "=", False)]. This override actually removes that domain filter and replaces it with a weaker search default that users can deselect, which would then show templates mixed in with projects. This is a regression from the native behavior. -
Simpler
create_project_from_templatevs nativeaction_create_from_template: The native method handles date shifting, field blacklisting, role-to-user mapping, and proper copy context. This module's method bypasses all of that. -
on_change_is_templatename mangling: The native 19.0 doesn't append "(TEMPLATE)" to the project name -- it uses a ribbon widget instead.
Given that Odoo 19.0 has native template support, this module either needs to be:
- Deprecated/removed with a note that functionality is now native, or
- Significantly reworked to only add value on top of the native implementation
The task date_end preservation via copy_data/update_date_end overrides might still add value, but the rest conflicts with or duplicates native functionality.
Minor: license header mismatch in __init__.py and __manifest__.py (copyright header says LGPLv3.0, manifest license field says AGPL-3).
| class Project(models.Model): | ||
| _inherit = "project.project" | ||
|
|
||
| is_template = fields.Boolean(copy=False) |
There was a problem hiding this comment.
This field is already defined natively in Odoo 19.0 project.project model (is_template = fields.Boolean(copy=False, export_string_translation=False)). Re-declaring it here is redundant.
| is_template = fields.Boolean(copy=False) | ||
|
|
||
| # CREATE A PROJECT FROM A TEMPLATE AND OPEN THE NEWLY CREATED PROJECT | ||
| def create_project_from_template(self): |
There was a problem hiding this comment.
Odoo 19.0 provides action_create_from_template() natively, which handles date shifting, field blacklisting, role-to-user mapping, and uses proper copy_from_template context. This simpler method bypasses all of that and produces inconsistent UX.
| ) | ||
|
|
||
| # OPEN THE NEWLY CREATED PROJECT FORM | ||
| return { |
There was a problem hiding this comment.
view_type is deprecated/removed in recent Odoo versions. This key is ignored in 19.0.
| <separator /> | ||
| </filter> | ||
| </field> | ||
| </record> |
There was a problem hiding this comment.
This overrides the native open_view_project_all and removes the domain [("is_template", "=", False)] that Odoo 19.0 sets natively. The native action filters templates via domain; this override replaces that with a search default, which is weaker (users can deselect it). This is a functional regression.
| @@ -0,0 +1,3 @@ | |||
| # License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). | |||
There was a problem hiding this comment.
License header says LGPLv3.0 but the manifest declares AGPL-3. Should be consistent.
|
Is it necessary if this functionality already exists in Odoo 19? |
No description provided.