Skip to content

[19.0][FIX] project_sequence: make creation test independent of sale_project#1730

Merged
OCA-git-bot merged 1 commit into
OCA:19.0from
ForgeFlow:19.0-fix-project_sequence-test-form-onchange
May 14, 2026
Merged

[19.0][FIX] project_sequence: make creation test independent of sale_project#1730
OCA-git-bot merged 1 commit into
OCA:19.0from
ForgeFlow:19.0-fix-project_sequence-test-form-onchange

Conversation

@DavidJForgeFlow
Copy link
Copy Markdown
Contributor

test_sequence_after_creation used Form(project.project) on a fresh record. Form initialization runs every model onchange to compute defaults, including sale_project's _onchange_sale_line_id, which reads reinvoiced_sale_order_id — a field restricted by sales_team.group_sale_salesman. When sale_project is installed in the same database, the project-only manager test user has no sale rights and the onchange raises AccessError, even though the behaviour being tested has nothing to do with sales. Check #1691 for an example.

Replace the Form-based pre-save check with a non-persisted new() record, which exercises the same invariant ("no sequence_code before creation") without triggering unrelated onchanges. The post-save assertions still use create() and remain unchanged.

test_sequence_after_creation used Form(project.project) on a fresh
record. Form initialization runs every model onchange to compute
defaults, including sale_project's _onchange_sale_line_id, which reads
reinvoiced_sale_order_id — a field restricted by
sales_team.group_sale_salesman. When sale_project is installed in the
same database, the project-only manager test user has no sale rights
and the onchange raises AccessError, even though the behaviour being
tested has nothing to do with sales.

Replace the Form-based pre-save check with a non-persisted new()
record, which exercises the same invariant ("no sequence_code before
creation") without triggering unrelated onchanges. The post-save
assertions still use create() and remain unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @yajo, @anddago78,
some modules you are maintaining are being modified, check this out!

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.

👍

@AaronHForgeFlow
Copy link
Copy Markdown

Merging to unlock other Migration PRs, apologies for the rush

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 19.0-ocabot-merge-pr-1730-by-AaronHForgeFlow-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 2f696f8 into OCA:19.0 May 14, 2026
7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 2f696f8. Thanks a lot for contributing to OCA. ❤️

@MiquelRForgeFlow MiquelRForgeFlow deleted the 19.0-fix-project_sequence-test-form-onchange branch May 14, 2026 13:53
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.

4 participants