Skip to content

Commit

Permalink
Merge pull request itpp-labs#487 from itpp-labs/17.0-partner_telegram
Browse files Browse the repository at this point in the history
⬆️ partner_telegram: update to v17
  • Loading branch information
yelizariev authored Feb 27, 2025
2 parents f02acbc + 8316a90 commit 8ec0b97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
22 changes: 19 additions & 3 deletions partner_telegram/static/src/js/telegram_widget.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
/** @odoo-module **/
/** Copyright 2024 Ivan Yelizariev <https://twitter.com/yelizariev> **/
/** Copyright 2024-2025 Ivan Yelizariev <https://twitter.com/yelizariev> **/

import { EmailField } from "@web/views/fields/email/email_field";
import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";

class TelegramField extends EmailField {}

TelegramField.template = "partner_contact.TelegramField";

export const telegramField = {
component: TelegramField,
displayName: _t("Telegram"),
supportedTypes: ["char"],
extractProps: ({ attrs }) => ({
placeholder: attrs.placeholder,
}),
};

registry.category("fields").add("telegram", telegramField);

class FormTelegramField extends TelegramField {}
FormTelegramField.template = "partner_contact.FormTelegramField";

registry.category("fields").add("telegram", TelegramField);
registry.category("fields").add("form.telegram", FormTelegramField);
export const formTelegramField = {
...telegramField,
component: FormTelegramField,
};

registry.category("fields").add("form.telegram", formTelegramField);
4 changes: 2 additions & 2 deletions partner_telegram/static/src/xml/telegram_widget.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2024 Ivan Yelizariev <https://twitter.com/yelizariev>
<!-- Copyright 2024-2025 Ivan Yelizariev <https://twitter.com/yelizariev>
License MIT (https://opensource.org/licenses/MIT). -->
<templates xml:space="preserve">
<t t-name="partner_contact.TelegramField" owl="1">
Expand Down Expand Up @@ -34,7 +34,7 @@
>
<xpath expr="//input" position="after">
<a
t-if="props.value"
t-if="props.record.data[props.name]"
t-att-href="props.record.data.telegram_url"
class="ms-3 d-inline-flex align-items-center"
>
Expand Down

0 comments on commit 8ec0b97

Please sign in to comment.