button_new_contract
A button that asks for a start date, checks twice that the date is legitimate, then creates the contract and loads it.
August 27, 2026Updated August 29, 20264 min read
| Technical name | button_new_contract |
|---|---|
| Views | form (view widget, <widget> element) |
| Module | hr, the Employees app |
| Used in core | The employee form in hr |
| Versions | Odoo 20.0, Odoo 19.0 |
| No-code setup | No. It is set in view XML and depends on module-specific data |
| Alternatives | versions_timeline, work_permit_upload, hr_department_chart |
What the new contract button does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
check_contract_finished | server check on the version | Asked before the picker opens, about the version being replaced. Raises rather than returning.(since Odoo 19.0) |
check_no_existing_contract | server check on the employee | Asked after a date is chosen, about that date. Raises rather than returning.(since Odoo 19.0) |
version_id | context key on reload | The newly created version, added to the search context so the form shows the new contract.(since Odoo 19.0) |
the picker type | fixed to date | A contract starts on a day, so there is no time component.(default: date)(since Odoo 19.0) |
The two checks happen at different moments. The first runs before the picker opens and looks at the current version. The second runs after a date is chosen and looks at that date. Neither is repeated.
Working examples
Two checks that only exist to raise
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | Partial / changed | Not released. Adds a guard suppressing an end-date dialog during the save. |
| Odoo 19.0 | Verified | First version. Verified against the shipped source. |
| Odoo 18.0 | Not available | Widget does not exist. |
| Odoo 17.0 | Not available | Widget does not exist. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. The widget is new in Odoo 19 alongside the version-based contract model. Databases upgrading from the older contract model gain this flow with the standard views.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| An error before the picker opens | The current version is not in a state that allows closing. Close or correct the existing contract first. |
| An error after choosing a date | A contract already covers that date. Pick a date after the existing contract ends. |
| Dismissing the picker does nothing | The apply handler guards against an empty date. Expected. |
| The form still shows the old contract | The reload adds the new version to the context; something overrode it. Reload the employee form manually. |
| An end-date dialog interrupts the save | Fixed on the development branch with a flag around the save. Complete the dialog and retry on Odoo 19. |
| The widget is missing | The employees module is not installed in that database. Install Employees. |
New contract button vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
button_new_contract | Creating a dated employee contract with its validity checked first | Two server-side checks at different moments, then a reload scoped to the new version |
| versions_timeline | A document's earlier versions | File history rather than contract creation |
| work_permit_upload | The work permit document | An upload rather than a record action |
hr_department_chart | Seeing the org structure | A chart rather than an action |
Frequently asked questions
Why are there two checks?+
Why is there no error handling?+
Why does the form reload?+
Can I pick a time as well as a date?+
Does it change in Odoo 20?+
HR data your payroll can trust
Contract versions, effective dates and payroll inputs have to agree, and an overlap is only visible once someone is paid wrong. We implement Odoo HR and payroll integration, on versions 16 through 19.
Book a free consultation