mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 10:32:02 +02:00
19.0 vanilla
This commit is contained in:
parent
a1137a1456
commit
e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions
|
|
@ -1,5 +1,3 @@
|
|||
/** @odoo-module */
|
||||
|
||||
import { registry } from '@web/core/registry';
|
||||
|
||||
import { listView } from '@web/views/list/list_view';
|
||||
|
|
@ -13,21 +11,20 @@ export class EmployeeListController extends ListController {
|
|||
this.archiveEmployee = useArchiveEmployee();
|
||||
}
|
||||
|
||||
getActionMenuItems() {
|
||||
const menuItems = super.getActionMenuItems();
|
||||
getStaticActionMenuItems() {
|
||||
const menuItems = super.getStaticActionMenuItems();
|
||||
const selectedRecords = this.model.root.selection;
|
||||
|
||||
// Only override the Archive action when only 1 record is selected.
|
||||
if (!this.archiveEnabled || selectedRecords.length > 1 || !selectedRecords[0].data.active) {
|
||||
return menuItems;
|
||||
}
|
||||
|
||||
const archiveAction = menuItems.other.find((item) => item.key === "archive");
|
||||
if (archiveAction) {
|
||||
archiveAction.callback = this.archiveEmployee.bind(this, selectedRecords[0].resId);
|
||||
}
|
||||
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', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue