base_telegram/views/base_telegram_view.xml

75 lines
3.3 KiB
XML
Raw Normal View History

2025-02-19 16:15:22 +03:00
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_base_telegram_api_view" model="ir.actions.act_window">
<field name="name">Base Telegram API</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base_telegram.api</field>
<field name="view_mode">tree,form,kanban</field>
<field name="domain"></field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Telegram Chats List
</p>
</field>
</record>
<record id="view_base_telegram_api_tree" model="ir.ui.view">
<field name="name">base_telegram.api.tree</field>
<field name="model">base_telegram.api</field>
<field name="arch" type="xml">
<tree multi_edit="1">
<field name="code" optional="show"/>
<field name="name" optional="show"/>
<field name="token" optional="show"/>
<field name="chat_id" optional="show"/>
</tree>
</field>
</record>
<record id="view_base_telegram_api_form" model="ir.ui.view">
<field name="name">base_telegram.api.form</field>
<field name="model">base_telegram.api</field>
<field name="arch" type="xml">
<form>
<header>
<button name="button_get_messages" string="Get Chat ID" class="btn-primary" type="object" invisible="not token" />
<button name="button_send_test" string="Send Test Message" class="btn-primary" type="object" invisible="not chat_id"/>
<button name="%(create_from_chat_id_wizard_action)d" string="Create Notification" class="btn-primary" type="action" invisible="not chat_id" target="new"/>
</header>
<sheet>
<group>
<group>
<field name="code"/>
<field name="name"/>
<field name="token"/>
<field name="chat_id"/>
</group>
<group col="2">
<div colspan="2">Creating a Telegram Bot:
<ul>
<li>Open the chat with <a href="https://t.me/BotFather">@BotFather</a></li>
<li>Enter the command <b>/newbot</b> to create a bot. Follow the instructions provided by @BotFather</li>
<li>Once completed, record the received <b>token</b> in the corresponding field.<br/>
In the chat with @BotFather, look for the text:<br/><code>
Use this token to access the HTTP API:<br/>
1234567890:ABcdeFghKLMNopqrs_TUvWxyz
</code></li>
<li>Create a group where the created bot should post messages</li>
<li>Add the bot to the group</li>
<li>Grant the bot admin access in the group</li>
<li>Send a test message in the group, ensure that the bot can read it</li>
<li>Click the button <b>Get Chat ID by test message</b> on this form</li>
<li>Enter the <b>Chat ID</b> value from the table of read messages into the <b>Chat ID</b> field</li>
</ul>
</div>
</group>
</group>
<field name="messages_html" columns="2"/>
</sheet>
</form>
</field>
</record>
</odoo>