[16.0][FIX] crm_date_deadline_required: fix usability issue on Kanban quick create#725
Conversation
|
Hi @EmilioPascual, @rafaelbn, |
|
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. |
EmilioPascual
left a comment
There was a problem hiding this comment.
@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", |
There was a problem hiding this comment.
It's not necessary update version, when the PR is merged, the versión is updated.
e699c1d to
3dfc870
Compare
|
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! |
|
/ocabot merge patch |
|
On my way to merge this fine PR! |
|
@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. |
|
@robperezit can you rebase and fix pre-commit? It was ko when I merged the PR. |
3dfc870 to
c9b6151
Compare
|
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. |
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_requiredmodule in Odoo 16.0, the Kanban "Quick Create" form closes automatically if the user interacts with thedate_deadlinefield (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:
@api.constrainsand overrode thecreatemethod incrm.leadto ensuredate_deadlineis strictly mandatory for opportunities at the server level.quick_createview inheritance to prevent the UI crash/auto-close.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