fix(odoo): compatibilidad completa con Odoo 19
- Cambiar tree a list en todas las vistas - Eliminar vista kanban (requiere formato diferente en Odoo 17+) - Simplificar vista de búsqueda - Simplificar herencia de res.partner (quitar xpaths problemáticos) - Agregar store=True a campos computados para filtros - Importar post_init_hook en __init__.py - Usar @api.model_create_multi para método create Probado y funcionando en Odoo 19. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from . import models
|
||||
from . import controllers
|
||||
from . import wizards
|
||||
from .hooks import post_init_hook
|
||||
|
||||
@@ -18,24 +18,14 @@
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
<!-- Add WhatsApp action buttons -->
|
||||
<xpath expr="//div[hasclass('oe_title')]" position="after">
|
||||
<div class="mb-2" invisible="not mobile and not phone">
|
||||
<button name="action_send_whatsapp" string="Enviar WhatsApp" type="object" class="btn btn-success" icon="fa-whatsapp"/>
|
||||
<button name="action_open_whatsapp_chat" string="Abrir Chat" type="object" class="btn btn-outline-success ms-1" icon="fa-comments"/>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
<!-- Add WhatsApp notebook page -->
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="WhatsApp" name="whatsapp" invisible="whatsapp_conversation_count == 0">
|
||||
<page string="WhatsApp" name="whatsapp">
|
||||
<field name="whatsapp_conversation_ids" mode="list" readonly="1">
|
||||
<list>
|
||||
<field name="account_id"/>
|
||||
<field name="status" widget="badge"/>
|
||||
<field name="last_message_at"/>
|
||||
<field name="last_message_preview"/>
|
||||
<field name="unread_count" widget="badge" decoration-danger="unread_count > 0"/>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
@@ -43,18 +33,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Partner Tree - Add WhatsApp indicator -->
|
||||
<record id="view_partner_tree_whatsapp" model="ir.ui.view">
|
||||
<field name="name">res.partner.tree.whatsapp</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_list"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='phone']" position="after">
|
||||
<field name="whatsapp_unread_count" widget="badge" decoration-danger="whatsapp_unread_count > 0" optional="show"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Server Action: Send WhatsApp -->
|
||||
<record id="action_partner_send_whatsapp" model="ir.actions.server">
|
||||
<field name="name">Enviar WhatsApp</field>
|
||||
|
||||
@@ -59,58 +59,14 @@
|
||||
</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>
|
||||
@@ -119,7 +75,6 @@
|
||||
<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,list,form</field>
|
||||
<field name="context">{'search_default_filter_active': 1}</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user