[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#136585 X-original-commit: 851c9fde8e73f30a164c81153e43160f95af6b0a Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user