[FIX] hr: reload_context when modifying the profile language
Before this commit, only when using the save button on the profile, the context is reloaded with the new language. If we use the breadcrumb to exit the profile view, the new language is saved, but the context is not reloaded. closes odoo/odoo#102493 X-original-commit: 41b2ca93f1fc6402ff5d88b7dd8af175dd49ac6d Related: odoo/enterprise#32432 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -1,29 +1,25 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { registry } from '@web/core/registry';
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
import { formView } from '@web/views/form/form_view';
|
||||
import { FormController } from '@web/views/form/form_controller';
|
||||
import { formView } from "@web/views/form/form_view";
|
||||
import { Record, RelationalModel } from "@web/views/basic_relational_model";
|
||||
|
||||
|
||||
export class EmployeeProfileFormController extends FormController {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.action = useService('action');
|
||||
}
|
||||
|
||||
async save(params = {}) {
|
||||
const dirtyFields = this.model.root.dirtyFields.map((f) => f.name);
|
||||
super.save(params);
|
||||
|
||||
if (dirtyFields.includes('lang')) {
|
||||
this.action.doAction("reload_context");
|
||||
export class EmployeeProfileRecord extends Record {
|
||||
async save() {
|
||||
const dirtyFields = this.dirtyFields.map((f) => f.name);
|
||||
const res = await super.save(...arguments);
|
||||
if (dirtyFields.includes("lang")) {
|
||||
this.model.actionService.doAction("reload_context");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
registry.category('views').add('hr_employee_profile_form', {
|
||||
class EmployeeProfileModel extends RelationalModel {}
|
||||
EmployeeProfileModel.Record = EmployeeProfileRecord;
|
||||
|
||||
registry.category("views").add("hr_employee_profile_form", {
|
||||
...formView,
|
||||
Controller: EmployeeProfileFormController,
|
||||
Model: EmployeeProfileModel,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user