Skip to content
Snippets Groups Projects
Commit 851c9fde authored by prye-odoo's avatar prye-odoo
Browse files

[FIX] hr_recruitment: handle key error in calendar.event object

When users try to apply for new job positions from the calendar view,
a traceback will occur.

Steps to reproduce:
- Install the "hr_recruitment" module.
- Go to the "Recruitment" icon; Kanban view will open;
choose any job position; and click on the "NEW APPLICATIONS" button.
- Then, select the "calendar" view and try to create a new record.
After that, a traceback error will occur.

Error:  KeyError: 'default_partner_ids'

When users try to apply for new job positions from the calendar view and
the 'default_partner_ids' key does not exist in the context dictionary,
a traceback occurs.
Code reference:
https://github.com/odoo/odoo/blob/16.0/addons/hr_recruitment/models/calendar.py#L18



sentry-4462451583

closes odoo/odoo#135253

Signed-off-by: default avatarSofie Gvaladze (sgv) <sgv@odoo.com>
parent 93e553c2
Branches
Tags
No related merge requests found
......@@ -14,9 +14,9 @@ class CalendarEvent(models.Model):
self = self.with_context(
default_res_model='hr.applicant', #res_model seems to be lost without this
default_res_model_id=self.env.ref('hr_recruitment.model_hr_applicant').id,
default_res_id=self.env.context['default_applicant_id'],
default_partner_ids=self.env.context['default_partner_ids'],
default_name=self.env.context['default_name']
default_res_id=self.env.context.get('default_applicant_id'),
default_partner_ids=self.env.context.get('default_partner_ids'),
default_name=self.env.context.get('default_name')
)
defaults = super(CalendarEvent, self).default_get(fields)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment