whatsapp_composer_views.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <data>
  4. <!-- Extender vista de formulario del composer de WhatsApp -->
  5. <record id="whatsapp_composer_view_form_groups" model="ir.ui.view">
  6. <field name="name">whatsapp.composer.view.form.groups</field>
  7. <field name="model">whatsapp.composer</field>
  8. <field name="inherit_id" ref="whatsapp.whatsapp_composer_view_form"/>
  9. <field name="arch" type="xml">
  10. <!-- Agregar opción de envío a grupos -->
  11. <xpath expr="//field[@name='phone']" position="before">
  12. <group string="Recipient Configuration" name="recipient_config">
  13. <field name="recipient_type" widget="radio" options="{'horizontal': true}"/>
  14. </group>
  15. </xpath>
  16. <!-- Hacer wa_template_id opcional para WhatsApp Web -->
  17. <xpath expr="//field[@name='wa_template_id']" position="attributes">
  18. <attribute name="help">Template required for WhatsApp Business API. Optional for WhatsApp Web accounts.</attribute>
  19. </xpath>
  20. <!-- Modificar campo phone para que sea condicional -->
  21. <xpath expr="//field[@name='phone']" position="attributes">
  22. <attribute name="invisible">recipient_type == 'group'</attribute>
  23. <attribute name="required">False</attribute>
  24. </xpath>
  25. <!-- Agregar campos de grupo después del teléfono -->
  26. <!-- Nota: El campo whatsapp_group_id Many2one está en whatsapp_web_groups -->
  27. <xpath expr="//field[@name='phone']" position="after">
  28. <field name="whatsapp_group_id_char"
  29. invisible="recipient_type != 'group'"
  30. placeholder="Enter Group ID manually (e.g., 120363158956331133@g.us)"
  31. string="Group ID"/>
  32. </xpath>
  33. <!-- Agregar campo de mensaje libre para WhatsApp Web -->
  34. <xpath expr="//field[@name='wa_template_id']" position="after">
  35. <field name="body"
  36. invisible="wa_template_id"
  37. placeholder="Write your free text message here (only for WhatsApp Web accounts)..."
  38. string="Free Text Message"/>
  39. </xpath>
  40. </field>
  41. </record>
  42. </data>
  43. </odoo>