19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:34 +01:00
parent 5faf7397c5
commit 2696f14ed7
721 changed files with 220375 additions and 91221 deletions

View file

@ -1,38 +1,43 @@
/** @odoo-modules */
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
const { Component } = owl;
import { standardWidgetProps } from "@web/views/widgets/standard_widget_props";
import { Component } from "@odoo/owl";
class IAPActionButtonsWidget extends Component {
static template = "iap.ActionButtonsWidget";
static props = {
...standardWidgetProps,
serviceName: String,
showServiceButtons: Boolean,
};
setup() {
this.orm = useService("orm");
this.action = useService("action");
}
async onViewServicesClicked() {
const url = await this.orm.silent.call("iap.account", "get_account_url");
this.action.doAction({
type: "ir.actions.act_url",
url: url,
});
this.action.doAction("iap.iap_account_action");
}
async onBuyLinkClicked() {
const url = await this.orm.silent.call("iap.account", "get_credits_url", [this.props.serviceName]);
async onManageServiceLinkClicked() {
const account_id = await this.orm.silent.call("iap.account", "get_account_id", [this.props.serviceName]);
this.action.doAction({
type: "ir.actions.act_url",
url: url,
type: "ir.actions.act_window",
res_model: "iap.account",
res_id: account_id,
views: [[false, "form"]],
});
}
}
IAPActionButtonsWidget.template = "iap.ActionButtonsWidget";
IAPActionButtonsWidget.extractProps = ({ attrs }) => {
return {
serviceName: attrs.service_name,
showServiceButtons: !Boolean(attrs.hide_service),
};
};
registry.category("view_widgets").add("iap_buy_more_credits", IAPActionButtonsWidget);
export const iapActionButtonsWidget = {
component: IAPActionButtonsWidget,
extractProps: ({ attrs }) => {
return {
serviceName: attrs.service_name,
showServiceButtons: !Boolean(attrs.hide_service),
};
},
};
registry.category("view_widgets").add("iap_buy_more_credits", iapActionButtonsWidget);

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<template id="template" xml:space="preserve">
<t t-name="iap.ActionButtonsWidget" owl="1">
<div class="mt-2 row">
<t t-name="iap.ActionButtonsWidget">
<div class="row">
<div class="col-sm">
<button t-on-click="onBuyLinkClicked" class="btn btn-link buy_credits px-0 o-hidden-ios"><i class="fa fa-arrow-right"/> Buy credits</button><br/>
<button t-if="props.showServiceButtons" t-on-click="onViewServicesClicked" class="btn btn-link px-0 o-hidden-ios"><i class="fa fa-arrow-right me-1"/> View My Services</button>
<button t-on-click="onManageServiceLinkClicked" class="btn btn-link px-0 o-hidden-ios text-nowrap"><i class="oi oi-arrow-right"/> Manage Service &amp; Buy Credits</button><br/>
<button t-if="props.showServiceButtons" t-on-click="onViewServicesClicked" class="btn btn-link px-0 o-hidden-ios text-nowrap"><i class="oi oi-arrow-right"/> View My Services</button>
</div>
</div>
</t>