feat(odoo): add conversation and partner views
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
125
odoo_whatsapp_hub/views/whatsapp_conversation_views.xml
Normal file
125
odoo_whatsapp_hub/views/whatsapp_conversation_views.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<!-- Tree View -->
|
||||
<record id="view_whatsapp_conversation_tree" model="ir.ui.view">
|
||||
<field name="name">whatsapp.conversation.tree</field>
|
||||
<field name="model">whatsapp.conversation</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-bf="unread_count > 0">
|
||||
<field name="display_name"/>
|
||||
<field name="phone_number"/>
|
||||
<field name="status" widget="badge" decoration-info="status == 'bot'" decoration-warning="status == 'waiting'" decoration-success="status == 'active'" decoration-muted="status == 'resolved'"/>
|
||||
<field name="assigned_user_id" widget="many2one_avatar_user"/>
|
||||
<field name="last_message_at"/>
|
||||
<field name="last_message_preview"/>
|
||||
<field name="unread_count" widget="badge" decoration-danger="unread_count > 0"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Form View -->
|
||||
<record id="view_whatsapp_conversation_form" model="ir.ui.view">
|
||||
<field name="name">whatsapp.conversation.form</field>
|
||||
<field name="model">whatsapp.conversation</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button name="action_assign_to_me" string="Asignarme" type="object" class="btn-primary" invisible="assigned_user_id"/>
|
||||
<button name="action_mark_resolved" string="Resolver" type="object" class="btn-secondary" invisible="status == 'resolved'"/>
|
||||
<field name="status" widget="statusbar" statusbar_visible="bot,waiting,active,resolved"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="display_name" readonly="1"/>
|
||||
<field name="phone_number"/>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="account_id"/>
|
||||
<field name="assigned_user_id"/>
|
||||
<field name="last_message_at"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Mensajes" name="messages">
|
||||
<field name="message_ids" mode="tree" readonly="1">
|
||||
<tree>
|
||||
<field name="create_date"/>
|
||||
<field name="direction" widget="badge"/>
|
||||
<field name="content"/>
|
||||
<field name="status" widget="badge"/>
|
||||
<field name="sent_by_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Kanban View -->
|
||||
<record id="view_whatsapp_conversation_kanban" model="ir.ui.view">
|
||||
<field name="name">whatsapp.conversation.kanban</field>
|
||||
<field name="model">whatsapp.conversation</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban default_group_by="status">
|
||||
<field name="display_name"/>
|
||||
<field name="phone_number"/>
|
||||
<field name="status"/>
|
||||
<field name="unread_count"/>
|
||||
<field name="last_message_preview"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click">
|
||||
<div class="oe_kanban_content">
|
||||
<div class="o_kanban_record_title">
|
||||
<strong><field name="display_name"/></strong>
|
||||
<span t-if="record.unread_count.raw_value > 0" class="badge bg-danger ms-2">
|
||||
<t t-esc="record.unread_count.value"/>
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
<field name="phone_number"/>
|
||||
</div>
|
||||
<div class="text-truncate">
|
||||
<field name="last_message_preview"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Search View -->
|
||||
<record id="view_whatsapp_conversation_search" model="ir.ui.view">
|
||||
<field name="name">whatsapp.conversation.search</field>
|
||||
<field name="model">whatsapp.conversation</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="display_name"/>
|
||||
<field name="phone_number"/>
|
||||
<field name="partner_id"/>
|
||||
<filter name="filter_unread" string="No Leídos" domain="[('unread_count', '>', 0)]"/>
|
||||
<filter name="filter_active" string="Activas" domain="[('status', 'in', ['bot', 'waiting', 'active'])]"/>
|
||||
<filter name="filter_mine" string="Mis Conversaciones" domain="[('assigned_user_id', '=', uid)]"/>
|
||||
<group expand="0" string="Agrupar por">
|
||||
<filter name="group_status" string="Estado" context="{'group_by': 'status'}"/>
|
||||
<filter name="group_account" string="Cuenta" context="{'group_by': 'account_id'}"/>
|
||||
<filter name="group_agent" string="Agente" context="{'group_by': 'assigned_user_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action -->
|
||||
<record id="action_whatsapp_conversation" model="ir.actions.act_window">
|
||||
<field name="name">Conversaciones</field>
|
||||
<field name="res_model">whatsapp.conversation</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="context">{'search_default_filter_active': 1}</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user