| 1 |
|
| 2 |
import { Component } from "@odoo/owl"; |
| 3 |
import { registry } from "@web/core/registry"; |
| 4 |
import { useService } from "@web/core/utils/hooks"; |
| 5 |
import {_t} from "@web/core/l10n/translation"; |
| 6 |
import { standardActionServiceProps } from "@web/webclient/actions/action_service"; |
| 7 |
|
| 8 |
|
| 9 |
class WhatIsPeppol extends Component { |
| 10 |
static props = { ...standardActionServiceProps }; |
| 11 |
static template = "account_peppol.WhatIsPeppol"; |
| 12 |
|
| 13 |
setup() { |
| 14 |
super.setup(); |
| 15 |
this.actionService = useService("action"); |
| 16 |
} |
| 17 |
|
| 18 |
closeButtonLabel() { |
| 19 |
if (this.props.action.context.action_on_activate.res_model === "peppol.registration") { |
| 20 |
return _t("Activate") |
| 21 |
} else { |
| 22 |
return _t("Got it !") |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
activate() { |
| 27 |
const action = this.props.action.context.action_on_activate; |
| 28 |
this.actionService.doAction({ |
| 29 |
name: action.name, |
| 30 |
type: action.type, |
| 31 |
res_model: action.res_model, |
| 32 |
views: [[false, action.view_mode]], |
| 33 |
target: action.target, |
| 34 |
context: action.context, |
| 35 |
}); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
registry.category("actions").add("account_peppol.what_is_peppol", WhatIsPeppol); |