-
-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] mail_activity_plan: Migration to 16.0
TT48098
- Loading branch information
1 parent
1daa97a
commit 0955eb0
Showing
6 changed files
with
112 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
mail_activity_plan/static/src/js/mail_activity_plan.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/** @odoo-module **/ | ||
|
||
import {FormController} from "@web/views/form/form_controller"; | ||
import {ListController} from "@web/views/list/list_controller"; | ||
import {onWillStart} from "@odoo/owl"; | ||
import {useService} from "@web/core/utils/hooks"; | ||
import {_lt} from "@web/core/l10n/translation"; | ||
import {patch} from "@web/core/utils/patch"; | ||
|
||
patch(FormController.prototype, "mail_activity_plan.FormControllerPatch", { | ||
async _actionWizardMailActivityPlan() { | ||
this.actionService.doAction( | ||
"mail_activity_plan.action_wizard_mail_activity_plan", | ||
{ | ||
additionalContext: { | ||
default_res_model: this.props.resModel, | ||
active_ids: [this.props.resId], | ||
}, | ||
on_close: () => { | ||
this.update({}, {reload: false}); | ||
}, | ||
} | ||
); | ||
}, | ||
setup() { | ||
this._super(); | ||
this.actionService = useService("action"); | ||
this.orm = useService("orm"); | ||
onWillStart(async () => { | ||
await this._showWizardMailActivityPlan(); | ||
}); | ||
}, | ||
async _showWizardMailActivityPlan() { | ||
const planCount = await this.orm.call( | ||
"mail.activity.plan", | ||
"get_total_plans_from_model", | ||
[this.props.resModel] | ||
); | ||
this.showWizardMailActivityPlan = planCount !== 0; | ||
}, | ||
getActionMenuItems() { | ||
const actionMenus = this._super(); | ||
if (actionMenus && this.showWizardMailActivityPlan) { | ||
actionMenus.other.push({ | ||
description: _lt("Launch Activity Plan"), | ||
callback: () => this._actionWizardMailActivityPlan(), | ||
}); | ||
} | ||
return actionMenus; | ||
}, | ||
}); | ||
|
||
patch(ListController.prototype, "mail_activity_plan", { | ||
async _actionWizardMailActivityPlan() { | ||
const resIds = await this.getSelectedResIds(); | ||
this.actionService.doAction( | ||
"mail_activity_plan.action_wizard_mail_activity_plan", | ||
{ | ||
additionalContext: { | ||
default_res_model: this.props.resModel, | ||
active_ids: resIds, | ||
}, | ||
on_close: () => { | ||
this.update({}, {reload: false}); | ||
}, | ||
} | ||
); | ||
}, | ||
setup() { | ||
this._super(); | ||
this.actionService = useService("action"); | ||
this.orm = useService("orm"); | ||
onWillStart(async () => { | ||
await this._showWizardMailActivityPlan(); | ||
}); | ||
}, | ||
async _showWizardMailActivityPlan() { | ||
const planCount = await this.orm.call( | ||
"mail.activity.plan", | ||
"get_total_plans_from_model", | ||
[this.props.resModel] | ||
); | ||
this.showWizardMailActivityPlan = planCount !== 0; | ||
}, | ||
getActionMenuItems() { | ||
const actionMenus = this._super(); | ||
if (actionMenus && this.showWizardMailActivityPlan) { | ||
actionMenus.other.push({ | ||
description: _lt("Launch Activity Plan"), | ||
callback: () => this._actionWizardMailActivityPlan(), | ||
}); | ||
} | ||
return actionMenus; | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters