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,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-inherit="mail.NotificationGroup" t-inherit-mode="extension">
<xpath expr="//*[hasclass('o_NotificationGroup_inlineText')]" position="inside">
<t t-if="notificationGroupView.notificationGroup.notification_type === 'snail'">
An error occurred when sending a letter with Snailmail.
</t>
</xpath>
</t>
</templates>

View file

@ -0,0 +1,31 @@
/** @odoo-module **/
import { useComponentToModel } from '@mail/component_hooks/use_component_to_model';
import { registerMessagingComponent } from '@mail/utils/messaging_component';
const { Component } = owl;
export class SnailmailError extends Component {
/**
* @override
*/
setup() {
useComponentToModel({ fieldName: 'component' });
}
/**
* @returns {SnailmailErrorView}
*/
get snailmailErrorView() {
return this.props.record;
}
}
Object.assign(SnailmailError, {
props: { record: Object },
template: 'snailmail.SnailmailError',
});
registerMessagingComponent(SnailmailError);

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="snailmail.SnailmailError" owl="1">
<t t-if="snailmailErrorView">
<div class="o_SnailmailError card bg-white" t-attf-class="{{ className }}" t-ref="root">
<h4 class="m-3">Failed letter</h4>
<hr class="mt-0 mb-3"/>
<t t-if="snailmailErrorView.notification.failure_type === 'sn_credit'">
<p class="o_SnailmailError_contentCredit mx-3 mb-3">
The letter could not be sent due to insufficient credits on your IAP account.
</p>
<t t-if="messaging.snailmail_credits_url">
<div class="text-end mx-3 mb-3">
<a class="btn btn-link" t-att-href="messaging.snailmail_credits_url" target="_blank">
<i class="fa fa-arrow-right"/> Buy credits
</a>
</div>
</t>
</t>
<t t-elif="snailmailErrorView.notification.failure_type === 'sn_trial'">
<p class="o_SnailmailError_contentTrial mx-3 mb-3">
You need credits on your IAP account to send a letter.
</p>
<t t-if="messaging.snailmail_credits_url_trial">
<div class="text-end mx-3 mb-3">
<a class="btn btn-link" t-att-href="messaging.snailmail_credits_url_trial">
<i class="fa fa-arrow-right"/> Buy credits
</a>
</div>
</t>
</t>
<t t-elif="snailmailErrorView.notification.failure_type === 'sn_price'">
<p class="o_SnailmailError_contentPrice mx-3 mb-3">
The country to which you want to send the letter is not supported by our service.
</p>
</t>
<t t-elif="snailmailErrorView.notification.failure_type === 'sn_error'">
<p class="o_SnailmailError_contentError mx-3 mb-3">
An unknown error occurred. Please contact our <a href="https://www.odoo.com/help" target="new">support</a> for further assistance.
</p>
</t>
<hr class="mt-0 mb-3"/>
<div class="o_SnailmailError_buttons mx-3 mb-3">
<t t-if="snailmailErrorView.hasCreditsError">
<button class="o_SnailmailError_resendLetterButton btn btn-primary me-2" t-on-click="snailmailErrorView.onClickResendLetter">Re-send letter</button>
</t>
<button class="o_SnailmailError_cancelLetterButton btn me-2"
t-att-class="{
'btn-primary': !snailmailErrorView.hasCreditsError,
'btn-secondary': snailmailErrorView.hasCreditsError,
}"
t-on-click="snailmailErrorView.onClickCancelLetter"
>
Cancel letter
</button>
<button class="o_SnailmailError_closeButton btn btn-secondary me-2" t-on-click="snailmailErrorView.onClickClose">Close</button>
</div>
</div>
</t>
</t>
</templates>

View file

@ -0,0 +1,24 @@
/** @odoo-module **/
import { registerMessagingComponent } from '@mail/utils/messaging_component';
const { Component } = owl;
export class SnailmailNotificationPopoverContentView extends Component {
/**
* @returns {SnailmailNotificationPopoverContentView}
*/
get snailmailNotificationPopoverContentView() {
return this.props.record;
}
}
Object.assign(SnailmailNotificationPopoverContentView, {
props: { record: Object },
template: 'snailmail.SnailmailNotificationPopoverContentView',
});
registerMessagingComponent(SnailmailNotificationPopoverContentView);

View file

@ -0,0 +1,7 @@
// -----------------------------------------------------------------------------
// Layout
// -----------------------------------------------------------------------------
.o_SnailmailNotificationPopoverContentView_icon {
margin-inline-end: map-get($spacers, 2);
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="snailmail.SnailmailNotificationPopoverContentView" owl="1">
<div class="o_SnailmailNotificationPopoverContentView m-2" t-attf-class="{{ className }}" t-ref="root">
<i class="o_SnailmailNotificationPopoverContentView_icon" t-att-class="snailmailNotificationPopoverContentView.iconClass" role="img"/>
<span t-esc="snailmailNotificationPopoverContentView.iconTitle"/>
</div>
</t>
</templates>