Skip to content

[18.0][MIG] project_wbs: Migration to 18.0#1690

Open
lbarry-apsl wants to merge 82 commits into
OCA:18.0from
APSL:18.0-mig-project_wbs
Open

[18.0][MIG] project_wbs: Migration to 18.0#1690
lbarry-apsl wants to merge 82 commits into
OCA:18.0from
APSL:18.0-mig-project_wbs

Conversation

@lbarry-apsl
Copy link
Copy Markdown
Member

AaronHForgeFlow and others added 30 commits March 11, 2026 14:25
enable opening the related view even when empty (needed for quick
project creation)
Currently translated at 1.8% (1 of 55 strings)

Translation: project-12.0/project-12.0-project_wbs
Translate-URL: https://translation.odoo-community.org/projects/project-12-0/project-12-0-project_wbs/de/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: project-12.0/project-12.0-project_wbs
Translate-URL: https://translation.odoo-community.org/projects/project-12-0/project-12-0-project_wbs/
Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

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

this needs much more work, amongst others compatibility with project_parent, lack of which is part of why tests fail left and right here

Copy link
Copy Markdown
Member

@cubells cubells left a comment

Choose a reason for hiding this comment

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

👍

LGTM

Code review and test

@lbarry-apsl lbarry-apsl requested a review from hbrunn May 8, 2026 07:24
@AaronHForgeFlow AaronHForgeFlow self-requested a review May 8, 2026 09:13
Copy link
Copy Markdown

@peluko00 peluko00 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@mpascuall mpascuall left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

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

When I click on WBS list to see the children:

Image

An I hit create then I expect to be able to be the name of the new project for quick creation, but it seems to be readonly, can you check?

Image

I understand that make this a dependent of project_parent is the natural evolution of the module.

@lbarry-apsl lbarry-apsl force-pushed the 18.0-mig-project_wbs branch from e29d1be to 1f4b048 Compare May 12, 2026 11:41
@lbarry-apsl lbarry-apsl force-pushed the 18.0-mig-project_wbs branch from 1f4b048 to 1293d87 Compare May 12, 2026 11:46
@lbarry-apsl
Copy link
Copy Markdown
Member Author

Done @AaronHForgeFlow !

Agreed, that makes sense as the next step.
This PR is the 18.0 migration of project_wbs; the inline creation adjustment is part of that migration.
I suggest handling the project_parent dependency/refactor in a separate follow-up PR.

@lbarry-apsl
Copy link
Copy Markdown
Member Author

Hi @hbrunn and @AaronHForgeFlow , can you review please?

Copy link
Copy Markdown

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

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

LGTM Functional.

Also I am no so sure we should make it depend on project_parent. This module relies on the analytic_account hierarchy not the project hierarchy. Moving all the features from the analytic account to the project is a dramatic change that affects all the features in the module and all the module that relies on this one, and requires complex migration scripts, for so little benefit.

Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

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

Also I am no so sure we should make it depend on project_parent. This module relies on the analytic_account hierarchy not the project hierarchy. Moving all the features from the analytic account to the project is a dramatic change that affects all the features in the module and all the module that relies on this one, and requires complex migration scripts, for so little benefit.

nobody has asked for this. But not breaking it is mandatory.

Out of scope for the migration, but I'd like to see this module gate its functionality with a type field/feature flag on accounts and projects, so that you can have analytic accounts and projects that don't have anything to do with WBS

Comment on lines +119 to +125
@api.model
def _default_parent(self):
return self.env.context.get("parent_id", None)

@api.model
def _default_partner(self):
return self.env.context.get("partner_id", None)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please remove those and change context keys to default_* where appropriate

_inherit = "account.analytic.account"
_order = "complete_wbs_code"

def get_child_accounts(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

are you sure this is faster than a modern child_of search?

account._complete_wbs_code_calc()
account._complete_wbs_name_calc()
if "active" in vals:
for account in self:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
for account in self:
for account in self.with_context(active_test=False):

otherwise you won't find nonactive projects

Comment on lines +178 to +181
parent_id = fields.Many2one(
default=_default_parent, string="Parent Analytic Account"
)
partner_id = fields.Many2one(default=_default_partner)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove as of above

Comment on lines +188 to +191
default = {}
default["code"] = self.env["ir.sequence"].next_by_code(
"account.analytic.account.code"
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we need this? the default should be provided by account_analytic_sequence already.

in any case, you overwrite existing defaults here which is a no-no

"within the project WBS hierarchy",
store=True,
)
code = fields.Char(copy=False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove, account_analytic_sequence already does this

def copy(self, default=None):
if self.mapped("project_ids"):
raise ValidationError(
_("Duplicate the project instead of the " "Analytic Account")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

join the string. but I don't think I agree with making this a hard failure anyways

return res

@api.depends("name")
def name_get(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

name_get isn't a thing any more, see https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-17.0

code_get should be integrated here as it's not used anywhere else

"UNIQUE (complete_wbs_code)",
"The full wbs code must be unique!",
),
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I stopped reviewing here, before asking for another review I invite you to adhere to all migration notes for all versions mentioned in https://github.com/OCA/maintainer-tools/wiki#migration, including reordering fields and functions, assigning compute functions by name and not by reference, and having a critical look on all field definitions if you don't redefine things that are already done elsewhere

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.