Initial commit: Core packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:45 +02:00
commit 12c29a983b
9512 changed files with 8379910 additions and 0 deletions

View file

@ -0,0 +1,27 @@
/** @odoo-module */
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
const { Component } = owl;
class ButtonWithNotification extends Component {
setup() {
this.orm = useService("orm");
this.notification = useService("notification");
}
async onClick() {
const result = await this.orm.call(this.props.record.resModel, this.props.method, [this.props.record.resId]);
const message = result.toast_message;
this.notification.add(message, { type: "success" });
}
}
ButtonWithNotification.template = "purchase.ButtonWithNotification";
ButtonWithNotification.extractProps = ({ attrs }) => {
return {
method: attrs.button_name,
title: attrs.title,
};
};
registry.category("view_widgets").add("toaster_button", ButtonWithNotification);

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<template>
<t t-name="purchase.ButtonWithNotification" owl="1">
<button t-on-click="onClick" t-att-name="props.method" type="button" class="btn oe_inline btn-link" t-att-title="props.title">
<i class="fa fa-fw o_button_icon fa-info-circle"></i>
</button>
</t>
</template>