whatsapp_composer_views.xml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. <xpath expr="//field[@name='phone']" position="after">
  27. <field name="whatsapp_group_id"
  28. invisible="recipient_type != 'group'"
  29. string="WhatsApp Group"
  30. placeholder="Select a WhatsApp group..."/>
  31. <field name="whatsapp_group_id_char"
  32. invisible="recipient_type != 'group'"
  33. placeholder="Or enter Group ID manually (e.g., 120363158956331133@g.us)"
  34. string="Group ID (Manual)"/>
  35. </xpath>
  36. <!-- Agregar campo de mensaje libre para WhatsApp Web -->
  37. <xpath expr="//field[@name='wa_template_id']" position="after">
  38. <field name="body"
  39. invisible="wa_template_id"
  40. placeholder="Write your free text message here (only for WhatsApp Web accounts)..."
  41. string="Free Text Message"/>
  42. </xpath>
  43. </field>
  44. </record>
  45. </data>
  46. </odoo>