Files
odoo_source/addons/sms/views/sms_sms_views.xml
T
Chong Wang (cwg) fd85e792ea [IMP] sms: slightly improve sms.sms list view
PURPOSE
We need this commit to provide a better visualization of the status of the SMS
and allow users to retry, send or cancel an SMS from the list view for a better UX

SPECS
sms.sms listview:
* reset 'failure_type' to False when its sms is resent
* 'sms status' column is moved to the right of the 'error code' column
* colors on the whole lines are removed
* the badge widget is used for the 'sms status' column
* new color for badges
    'in queue': blue
    'sent': green
    'error': red
    'canceled': gray
* new buttons are added to directly retry, send or cancel an SMS from the list view
    'fa-paper-plane send now' button
        only visible if the status is 'in queue'
        clicking on this button should effectively send the SMS
    'fa-times-circle cancel' button
        only visible if the status is 'in queue' or 'error'
        clicking on this button should switch the sms to the 'canceled' state
    'fa-repeat retry' button
        only visible if the status is 'error' or 'canceled'
        clicking on this button should switch the sms to the 'in queue' state

LINKS
task-2535005

closes odoo/odoo#74354

Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2021-09-28 10:53:15 +00:00

81 lines
3.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo><data>
<record id="sms_tsms_view_form" model="ir.ui.view">
<field name="name">sms.sms.view.form</field>
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<form string="SMS">
<header>
<button name="send" string="Send Now" type="object" states='outgoing' class="oe_highlight"/>
<button name="action_set_outgoing" string="Retry" type="object" states='error,canceled'/>
<button name="action_set_canceled" string="Cancel" type="object" states='error,outgoing'/>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<group>
<group>
<field name="partner_id" string="Contact"/>
<field name="mail_message_id" readonly="1" attrs="{'invisible': [('mail_message_id', '=', False)]}"/>
</group>
<group>
<field name="number" required="1"/>
<field name="failure_type" readonly="1" attrs="{'invisible': [('failure_type', '=', False)]}"/>
</group>
</group>
<group>
<field name="body" widget="sms_widget" string="Message" required="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="sms_sms_view_tree" model="ir.ui.view">
<field name="name">sms.sms.view.tree</field>
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<tree string="SMS Templates">
<field name="number"/>
<field name="partner_id"/>
<field name="failure_type"/>
<field name="state" widget="badge" decoration-info="state == 'outgoing'" decoration-muted="state == 'canceled'" decoration-success="state == 'sent'" decoration-danger="state == 'error'"/>
<button name="send" string="Send Now" type="object" icon="fa-paper-plane" states="outgoing"/>
<button name="action_set_outgoing" string="Retry" type="object" icon="fa-repeat" states="error,canceled"/>
<button name="action_set_canceled" string="Cancel" type="object" icon="fa-times-circle" states="error,outgoing"/>
</tree>
</field>
</record>
<record id="sms_sms_view_search" model="ir.ui.view">
<field name="name">sms.sms.view.search</field>
<field name="model">sms.sms</field>
<field name="arch" type="xml">
<search string="Search SMS Templates">
<field name="number"/>
<field name="partner_id"/>
</search>
</field>
</record>
<record id="sms_sms_action" model="ir.actions.act_window">
<field name="name">SMS</field>
<field name="res_model">sms.sms</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="sms_sms_menu"
parent="phone_validation.phone_menu_main"
action="sms_sms_action"
sequence="1"/>
<record id="ir_actions_server_sms_sms_resend" model="ir.actions.server">
<field name="name">Resend</field>
<field name="model_id" ref="sms.model_sms_sms"/>
<field name="binding_model_id" ref="sms.model_sms_sms"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.resend_failed()</field>
</record>
</data>
</odoo>