odex25_standard/odex25_base/whatsapp/views/whatsapp_template_views.xml

256 lines
15 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="whatsapp_template_view_form" model="ir.ui.view">
<field name="name">whatsapp.template.view.form</field>
<field name="model">whatsapp.template</field>
<field name="arch" type="xml">
<form string="WhatsApp Template">
<header>
<field name="has_action" invisible="1"/>
<button name="button_reset_to_draft"
string="Reset to draft" type="object"
attrs="{'invisible': [('status', 'not in', ['rejected', 'approved'])]}"
groups="whatsapp.group_whatsapp_admin"/>
<button name="button_submit_template" string="Submit for Approval"
class="btn btn-primary" type="object"
attrs="{'invisible': ['|', ('wa_account_id', '=', False), ('status', '!=', 'draft')]}"
groups="whatsapp.group_whatsapp_admin"/>
<button name="button_create_action" string="Allow Multi"
class="btn btn-primary" type="object"
attrs="{'invisible': ['|', ('has_action', '!=', False), ('status', '!=', 'approved')]}"
groups="whatsapp.group_whatsapp_admin"/>
<button name="button_delete_action" string="Disallow Multi"
type="object"
groups="whatsapp.group_whatsapp_admin"
attrs="{'invisible': ['|', ('has_action', '=', False), ('status', '!=', 'approved')]}"
confirm="There might be other templates that still need the Multi"/>
<button name="button_sync_template" string="Sync Template"
type="object"
attrs="{'invisible': [('wa_template_uid', '=', False)]}"
groups="whatsapp.group_whatsapp_admin"/>
<button name="button_sync_template" string="Sync Template"
type="object" class="btn btn-primary"
attrs="{'invisible': ['|','|',('is_test', '=', False),('status','!=','pending'),('wa_template_uid', '=', True)]}"
groups="whatsapp.group_whatsapp_admin"/>
<button name="%(whatsapp_preview_action_from_template)d" string="Preview"
type="action" target="new"
context="{'active_id': id, 'dialog_size': 'medium'}"/>
<field name="status" widget="statusbar" statusbar_visible="draft,pending,approved"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button type="object" name="action_open_messages" class="oe_stat_button" icon="fa-whatsapp">
<field name="messages_count" string="Messages" widget="statinfo"/>
</button>
</div>
<widget name="web_ribbon" title="Archived" bg_color="text-bg-danger"
attrs="{'invisible': [('active', '!=', False)]}"/>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group>
<field name="active" invisible="1"/>
<field name="wa_account_id"
groups="whatsapp.group_whatsapp_admin"
attrs="{'readonly': [('status', '!=', 'draft')]}"/>
<field name="model" invisible="1"/>
<field name="model_id"/>
<field name="phone_field"
options="{'model': 'model'}"/>
<field name="template_type" attrs="{'readonly': [('status', '!=', 'draft')]}"/>
<field name="allowed_user_ids"
widget="many2many_tags_avatar"
placeholder="Users who can use this template.If empty then public."/>
<field name="is_test"/>
</group>
<group>
<field name="template_name"
attrs="{'readonly': ['|', ('wa_template_uid', '=', False), ('status', '!=', 'draft')]}"/>
<field name="lang_code"
attrs="{'readonly': [('status', '!=', 'draft')]}"/>
<field name="header_type"
attrs="{'readonly': [('status', '!=', 'draft')]}" required="1"/>
<field name="header_text"
attrs="{'invisible': [('header_type', '!=', 'text')], 'required': [('header_type', '=', 'text')], 'readonly': [('status', '!=', 'draft')]}"
placeholder="e.g. Invitation for {{1}}"/>
<field name="header_attachment_ids"
widget="many2many_binary"
attrs="{'invisible': [('header_type', 'not in', ['image', 'video', 'document'])]}"/>
<field name="report_id"
attrs="{'invisible': [('header_type', '!=', 'document')]}"/>
<field name="footer_text"
attrs="{'readonly': [('status', '!=', 'draft')]}"/>
<field name="quality" widget="priority"
attrs="{'invisible': [('quality', '=', 'none')]}" readonly="1"/>
<field name="wa_template_uid" invisible="1"/>
</group>
</group>
<notebook>
<page id="body" name="Body" string="Body">
<field name="body"
placeholder="Your whatsapp message, use {{1}}, {{2}} as placeholders for dynamic variable"
attrs="{'readonly': [('status', '!=', 'draft')]}" required="1"/>
</page>
<page id="buttons" name="Buttons" string="Buttons">
<field name="button_ids">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="button_type"/>
<field name="name" required="1"/>
<field name="reply_template_id" domain="[('status', '=', 'approved')]"
attrs="{'invisible': [('button_type', '!=', 'quick_reply')], 'required': [('button_type', '=', 'quick_reply')]}"/>
<field name="call_number"
attrs="{'readonly': [('button_type', '!=', 'phone_number')], 'required': [('button_type', '=', 'phone_number')], 'invisible': [('button_type', '!=', 'phone_number')]}"/>
<field name="website_url"
attrs="{'readonly': [('button_type', '!=', 'url')], 'required': [('button_type', '=', 'url')], 'invisible': [('button_type', '!=', 'url')]}"
placeholder="e.g. https://www.example.com"/>
<field name="url_type"
attrs="{'required': [('button_type', '=', 'url')], 'invisible': [('button_type', '!=', 'url')]}"/>
<button name="action_open_edit_reply_template"
string="Reply Template" type="object"
attrs="{'invisible': ['|', ('button_type', '!=', 'quick_reply'), ('parent.status', '!=', 'approved')]}"/>
</tree>
</field>
</page>
<page id="variables" name="Variables" string="Variables">
<field name="variable_ids">
<tree editable="bottom" create="false" delete="false">
<field name="display_name" string="Name"/>
<field name="demo_value" required="1"/>
<field name="field_type"/>
<field name="field_name"
attrs="{'required': [('field_type', '=', 'field')], 'readonly': [('field_type', '!=', 'field')], 'invisible': [('field_type', '!=', 'field')]}"
options="{'model': 'model'}"/>
<field name="model" invisible="1"/>
<field name="line_type" invisible="1" force_save="1"/>
<field name="name" invisible="1" force_save="1"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="whatsapp_template_view_tree" model="ir.ui.view">
<field name="name">whatsapp.template.view.tree</field>
<field name="model">whatsapp.template</field>
<field name="arch" type="xml">
<tree string="WhatsApp Template">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="model_id"/>
<field name="template_name" optional="hidden"/>
<field name="header_type" optional="hidden"/>
<field name="create_uid" widget="many2one_avatar"/>
<field name="create_date" optional="hidden"/>
<field name="quality" widget="priority" optional="hidden" readonly="1"/>
<field name="status"
decoration-success="status == 'approved'"
decoration-danger="status == 'rejected'"
widget="badge"/>
</tree>
</field>
</record>
<record id="whatsapp_template_view_kanban" model="ir.ui.view">
<field name="name">whatsapp.template.view.kanban</field>
<field name="model">whatsapp.template</field>
<field name="arch" type="xml">
<kanban>
<field name="id"/>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="oe_kanban_details">
<div class="o_kanban_record_top mb16">
<div class="o_kanban_record_headings mt4">
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
<div class="text-muted o_row">
<field name="model_id"/>
</div>
</div>
<strong>
<field name="status"
widget="label_selection"
options="{'classes': {'approved': 'success', 'rejected': 'danger'}}"/>
</strong>
</div>
<div class="o_kanban_record_bottom" t-if="!selection_mode">
<div class="oe_kanban_bottom_left">
<field name="quality" widget="priority" readonly="1"/>
<field name="create_date" widget="date"/>
<div>
<i class="fa fa-whatsapp me-1" title="Messages Count"
aria-label="Messages Count"/>
<field name="messages_count"/>
</div>
</div>
<div class="oe_kanban_bottom_right" t-if="!selection_mode">
<field name="allowed_user_ids"/>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="whatsapp_template_view_search" model="ir.ui.view">
<field name="name">whatsapp.template.view.search</field>
<field name="model">whatsapp.template</field>
<field name="arch" type="xml">
<search string="Templates">
<field name="name"/>
<field name="model_id"/>
<field name="model" invisible="1"/>
<separator/>
<filter string="My Templates" name="my" domain="[('create_uid', '=', uid)]"/>
<separator/>
<filter string="Archived" name="filter_archived" domain="[('active', '=', False)]"/>
<group expand="0" string="Group By">
<filter string="Model" name="model_id" domain="[]" context="{'group_by': 'model_id'}"/>
<filter string="Status" name="status" domain="[]" context="{'group_by': 'status'}"/>
</group>
</search>
</field>
</record>
<record id="whatsapp_template_action" model="ir.actions.act_window">
<field name="name">WhatsApp Template</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">whatsapp.template</field>
<field name="view_mode">tree,kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
Create or sync WhatsApp Templates.
</p>
<p>
You can retrieve templates from Facebook by clicking <strong>Sync Templates</strong> on the <a
name="%(whatsapp.whatsapp_account_action)d" type="action" class="oe_link">WhatsApp Business
Account</a>.
Or create templates here and send them for approval.
Please refer the
<a href="https://developers.facebook.com/docs/whatsapp/message-templates/guidelines" target="_blank">
Template Guidelines
</a>
</p>
</field>
</record>
</odoo>