mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-23 15:52:04 +02:00
33 lines
920 B
JavaScript
33 lines
920 B
JavaScript
import { registry } from '@web/core/registry';
|
|
|
|
import { listView } from '@web/views/list/list_view';
|
|
import { ListController } from '@web/views/list/list_controller';
|
|
|
|
import { useArchiveEmployee } from '@hr/views/archive_employee_hook';
|
|
|
|
export class EmployeeListController extends ListController {
|
|
setup() {
|
|
super.setup();
|
|
this.archiveEmployee = useArchiveEmployee();
|
|
}
|
|
|
|
getStaticActionMenuItems() {
|
|
const menuItems = super.getStaticActionMenuItems();
|
|
const selectedRecords = this.model.root.selection;
|
|
|
|
menuItems.archive.callback = this.archiveEmployee.bind(
|
|
this,
|
|
selectedRecords.map(({resId}) => resId),
|
|
)
|
|
return menuItems;
|
|
}
|
|
|
|
async createRecord() {
|
|
await this.props.createRecord();
|
|
}
|
|
}
|
|
|
|
registry.category('views').add('hr_employee_list', {
|
|
...listView,
|
|
Controller: EmployeeListController,
|
|
});
|