[IMP] web: make ability to modify archive confirmation
In this commit, we have implemented a dedicated function that enables the customization of details in the confirmation dialog for the archive action. task-3277195 closes odoo/odoo#125533 Related: odoo/enterprise#39926 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
@@ -329,13 +329,7 @@ export class FormController extends Component {
|
||||
description: this.env._t("Archive"),
|
||||
icon: "oi oi-archive",
|
||||
callback: () => {
|
||||
const dialogProps = {
|
||||
body: this.env._t("Are you sure that you want to archive this record?"),
|
||||
confirmLabel: this.env._t("Archive"),
|
||||
confirm: () => this.model.root.archive(),
|
||||
cancel: () => {},
|
||||
};
|
||||
this.dialogService.add(ConfirmationDialog, dialogProps);
|
||||
this.dialogService.add(ConfirmationDialog, this.archiveDialogProps);
|
||||
},
|
||||
},
|
||||
unarchive: {
|
||||
@@ -363,6 +357,15 @@ export class FormController extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
get archiveDialogProps() {
|
||||
return {
|
||||
body: this.env._t("Are you sure that you want to archive this record?"),
|
||||
confirmLabel: this.env._t("Archive"),
|
||||
confirm: () => this.model.root.archive(),
|
||||
cancel: () => {},
|
||||
};
|
||||
}
|
||||
|
||||
get actionMenuItems() {
|
||||
const { actionMenus } = this.props.info;
|
||||
const staticActionItems = Object.entries(this.getStaticActionMenuItems())
|
||||
|
||||
@@ -302,17 +302,7 @@ export class ListController extends Component {
|
||||
icon: "oi oi-archive",
|
||||
description: this.env._t("Archive"),
|
||||
callback: () => {
|
||||
const dialogProps = {
|
||||
body: this.env._t(
|
||||
"Are you sure that you want to archive all the selected records?"
|
||||
),
|
||||
confirmLabel: this.env._t("Archive"),
|
||||
confirm: () => {
|
||||
this.toggleArchiveState(true);
|
||||
},
|
||||
cancel: () => {},
|
||||
};
|
||||
this.dialogService.add(ConfirmationDialog, dialogProps);
|
||||
this.dialogService.add(ConfirmationDialog, this.archiveDialogProps);
|
||||
},
|
||||
},
|
||||
unarchive: {
|
||||
@@ -332,6 +322,17 @@ export class ListController extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
get archiveDialogProps() {
|
||||
return {
|
||||
body: this.env._t("Are you sure that you want to archive all the selected records?"),
|
||||
confirmLabel: this.env._t("Archive"),
|
||||
confirm: () => {
|
||||
this.toggleArchiveState(true);
|
||||
},
|
||||
cancel: () => {},
|
||||
};
|
||||
}
|
||||
|
||||
get actionMenuItems() {
|
||||
const { actionMenus } = this.props.info;
|
||||
const staticActionItems = Object.entries(this.getStaticActionMenuItems())
|
||||
|
||||
Reference in New Issue
Block a user