Skip to content

[16.0][FIX] crm_date_deadline_required: fix usability issue on Kanban quick create#725

Open
robperezit wants to merge 1 commit into
OCA:16.0from
robperezit:16.0-fix-crm_date_deadline_required-quick_create
Open

[16.0][FIX] crm_date_deadline_required: fix usability issue on Kanban quick create#725
robperezit wants to merge 1 commit into
OCA:16.0from
robperezit:16.0-fix-crm_date_deadline_required-quick_create

Conversation

@robperezit
Copy link
Copy Markdown

In Odoo 16.0, adding a date field to the Kanban Quick Create form causes the form to close prematurely when the datepicker loses focus due to the OWL component lifecycle. This commit moves the requirement logic to the backend to preserve usability while ensuring data integrity.

Bug Description

As reported in #695, when using the crm_date_deadline_required module in Odoo 16.0, the Kanban "Quick Create" form closes automatically if the user interacts with the date_deadline field (DatePicker) before completing other fields. This is caused by the native OWL lifecycle in the Kanban view, which triggers a save/close event upon focus loss of date widgets.

Solution

Since the framework's behavior in v16 makes it unstable to include a required date field directly in the Quick Create popover, this PR implements a more robust "Backend-First" approach:

  1. Backend Validation: Added @api.constrains and overrode the create method in crm.lead to ensure date_deadline is strictly mandatory for opportunities at the server level.
  2. View Optimization: Removed the quick_create view inheritance to prevent the UI crash/auto-close.
  3. Standard Workflow: By enforcing the requirement in Python, if a user attempts to "Quick Create" an opportunity without a date, Odoo will trigger a ValidationError. The native web client then automatically redirects the user to the full form view with all previously entered data, where they can set the date without UI issues.

Integrity

This change ensures that no opportunity can be created without a deadline through any channel (UI, API, or Import), while restoring a fluid workflow for sales teams using the Pipeline Kanban view.

Fixes #695

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @EmilioPascual, @rafaelbn,
some modules you are maintaining are being modified, check this out!

@robperezit
Copy link
Copy Markdown
Author

All functional tests and linting checks are passing. Regarding the Codecov alert, the patch has 90% coverage, which ensures the new backend validation is correctly tested. The logic is ready for review.

Copy link
Copy Markdown
Contributor

@EmilioPascual EmilioPascual left a comment

Choose a reason for hiding this comment

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

@robperezit can you do squash for all commits, just 1 commit please

"name": "CRM Date Deadline Required",
"summary": "Field date deadline required in the opportunity",
"version": "16.0.1.0.0",
"version": "16.0.1.0.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not necessary update version, when the PR is merged, the versión is updated.

@robperezit robperezit force-pushed the 16.0-fix-crm_date_deadline_required-quick_create branch from e699c1d to 3dfc870 Compare February 4, 2026 13:40
@robperezit
Copy link
Copy Markdown
Author

Hi @EmilioPascual, thank you for the review. I have squashed the commits into a single one and reverted the version change in the manifest as requested. All functional tests and linting checks are green. Ready for final review!

Copy link
Copy Markdown
Contributor

@EmilioPascual EmilioPascual 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

Copy link
Copy Markdown

@luisDIXMIT luisDIXMIT left a comment

Choose a reason for hiding this comment

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

Code review and LGTM!

@EmilioPascual
Copy link
Copy Markdown
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-725-by-EmilioPascual-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Apr 9, 2026
Signed-off-by EmilioPascual
@OCA-git-bot
Copy link
Copy Markdown
Contributor

@EmilioPascual your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-725-by-EmilioPascual-bump-patch.

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.

@EmilioPascual
Copy link
Copy Markdown
Contributor

@robperezit can you rebase and fix pre-commit? It was ko when I merged the PR.

@robperezit robperezit force-pushed the 16.0-fix-crm_date_deadline_required-quick_create branch from 3dfc870 to c9b6151 Compare April 17, 2026 14:38
@OCA-git-bot OCA-git-bot added mod:crm_date_deadline_required Module crm_date_deadline_required series:16.0 labels Apr 17, 2026
@robperezit
Copy link
Copy Markdown
Author

Hi @EmilioPascual, the pre-commit job fails with "ModuleNotFoundError: No module named 'pkg_resources'" in the setuptools-odoo-make-default and setuptools-odoo-get-requirements hooks. This is an environment configuration issue - the runner needs setuptools installed. All functional checks (pylint, flake8) passed successfully. With 2 LGTMs, this is ready once the CI environment is fixed.

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.

4 participants