[FIX] hr_holidays: Only show time off of current company's employee
Step to reproduce (Traceback): - Be in multi-company - Create a time off type with duration in hour and no company_id - Create an instance of this type on company A with a user linked to company A (need access to both) - Switch to company B Current Behaviour: - Traceback - Cannot fetch user's calendar if content of company A is not checked for convertion from Days to Hour Behaviour after PR: - We only fetch if the user related to the leave is in allowed_companies -> only fetch if the user data is available - This is also true if duration is in Days/Half-Days (GMF Approved) opw-2749258 closes odoo/odoo#88104 X-original-commit: cb5942e5461ec0fc1fa54cd249de23e4f28f8692 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
committed by
Kevin Baptiste
parent
2c0a76b6ad
commit
2ba4e04953
@@ -1,12 +1,14 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { TimeOffCalendarEmployeeController } from "./time_off_calendar_employee_controller";
|
||||
import { TimeOffCalendarModel } from "./time_off_calendar_model";
|
||||
import { TimeOffCalendarView } from "./time_off_calendar_views";
|
||||
import viewRegistry from 'web.view_registry';
|
||||
|
||||
export const TimeOffCalendarEmployeeView = TimeOffCalendarView.extend({
|
||||
config: Object.assign({}, TimeOffCalendarView.prototype.config, {
|
||||
Controller: TimeOffCalendarEmployeeController,
|
||||
Model: TimeOffCalendarModel,
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import CalendarModel from "web.CalendarModel";
|
||||
|
||||
|
||||
export const TimeOffCalendarModel = CalendarModel.extend({
|
||||
_getFilterDomain: function() {
|
||||
const company_domain = [['user_id.company_id', 'in', this.data.context.allowed_company_ids]];
|
||||
return this._super().concat(company_domain);
|
||||
},
|
||||
});
|
||||
@@ -3,6 +3,7 @@
|
||||
import CalendarView from "web.CalendarView";
|
||||
import config from 'web.config';
|
||||
import { TimeOffCalendarController } from "./time_off_calendar_controller";
|
||||
import { TimeOffCalendarModel } from "./time_off_calendar_model";
|
||||
import { TimeOffCalendarRenderer } from "./time_off_calendar_renderer";
|
||||
import { TimeOffPopoverRenderer } from "./time_off_popover_renderer";
|
||||
import viewRegistry from 'web.view_registry';
|
||||
@@ -10,6 +11,7 @@ import viewRegistry from 'web.view_registry';
|
||||
export const TimeOffCalendarView = CalendarView.extend({
|
||||
config: Object.assign({}, CalendarView.prototype.config, {
|
||||
Controller: TimeOffCalendarController,
|
||||
Model: TimeOffCalendarModel,
|
||||
Renderer: TimeOffCalendarRenderer,
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user