summaryrefslogtreecommitdiff
path: root/addons/mass_mailing_sms/views/mailing_mailing_views.xml
blob: bbf64b00a59fe268aebba974a49dfb30931d62bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?xml version="1.0" encoding="utf-8"?>
<odoo><data>

    <record model="ir.ui.view" id="mailing_mailing_view_search_sms">
        <field name="name">mailing.mailing.search</field>
        <field name="model">mailing.mailing</field>
        <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_search"/>
        <field name="mode">primary</field>
        <field name="arch" type="xml">
            <xpath expr="//filter[@name='assigned_to_me']" position="attributes">
                <attribute name="string">My SMS Marketing</attribute>
            </xpath>
        </field>
    </record>

    <record id="mailing_mailing_view_form_sms" model="ir.ui.view">
        <field name="name">mailing.mailing.view.form.inherit.sms</field>
        <field name="model">mailing.mailing</field>
        <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form"/>
        <field name="arch" type="xml">
            <!-- Buttons / Actions -->
            <xpath expr="//button[@name='action_put_in_queue']" position="attributes">
                <attribute name="attrs">{'invisible': ['|', ('state', 'in', ('in_queue', 'done')), ('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//button[@name='action_put_in_queue']" position="after">
                <button name="action_put_in_queue_sms" type="object"
                    class="oe_highlight" string="Put in Queue"
                    attrs="{'invisible': ['|', ('mailing_type', '=', 'mail'), ('state', 'in', ('in_queue', 'done'))]}"
                    confirm="This will schedule an SMS marketing to all recipients. Do you still want to proceed ?"/>
                <button name="action_send_now_sms" type="object"
                    string="Send Now"
                    attrs="{'invisible': ['|', ('mailing_type', '=', 'mail'), ('state', 'in', ('done'))]}"
                    confirm="This will send SMS to all recipients now. Do you still want to proceed ?"/>
            </xpath>
            <!-- Headers / Warnings -->
            <xpath expr="//header" position="after">
                <field name="sms_has_insufficient_credit" invisible="1"/>
                <div class="alert alert-warning text-center o-hidden-ios" attrs="{'invisible': [('sms_has_insufficient_credit', '=', False)]}" role="alert">
                    <button class="btn-link py-0"
                            name="action_buy_sms_credits"
                            type="object">
                        <strong>
                            It appears you don't have enough IAP credits. Click here to buy credits.
                        </strong>
                    </button>
                </div>
                <field name="sms_has_unregistered_account" invisible="1"/>
                <div class="alert alert-warning text-center o-hidden-ios" attrs="{'invisible': [('sms_has_unregistered_account', '=', False)]}" role="alert">
                    <button class="btn-link py-0"
                            name="action_buy_sms_credits"
                            type="object">
                        <strong>
                            It appears your SMS account is not registered. Click here to set up your account.
                        </strong>
                    </button>
                </div>
            </xpath>
            <xpath expr="//span[@name='ignored_text']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//span[@name='ignored_text']" position="after">
                <span name="ignored_text_sms" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">SMS Text Message have been ignored and will not be sent.</span>
            </xpath>
            <xpath expr="//span[@name='scheduled_text']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//span[@name='scheduled_text']" position="after">
                <span name="scheduled_text_sms" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">SMS Text Message are in queue and will be sent soon.</span>
            </xpath>
            <xpath expr="//span[@name='sent']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//span[@name='sent']" position="after">
                <span name="sent_sms" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">SMS Text Message have been sent.</span>
            </xpath>
            <xpath expr="//span[@name='failed_text']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//span[@name='failed_text']" position="after">
                <span name="failed_text_sms" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">SMS Text Message could not be sent.</span>
            </xpath>
            <xpath expr="//span[@name='next_departure_text']" position='attributes'>
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//span[@name='next_departure_text']" position='after'>
                <span name="next_departure_text" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">This SMS marketing is scheduled for </span>
            </xpath>
            <!-- Stat Buttons -->
            <xpath expr="//button[@name='action_view_opened']" position="attributes">
                <attribute name="attrs">{'invisible': ['|',('mailing_type', '!=', 'mail'),('state', 'in', ('draft','test'))]}</attribute>
            </xpath>
            <xpath expr="//button[@name='action_view_replied']" position="attributes">
                <attribute name="attrs">{'invisible': ['|',('mailing_type', '!=', 'mail'),('state', 'in', ('draft','test'))]}</attribute>
            </xpath>
            <!-- Form -->
            <xpath expr="//field[@name='subject']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')], 'readonly': [('state', 'in', ('sending', 'done'))], 'required': [('mailing_type', '=', 'mail')]}</attribute>
                <!-- overrided in xml view to prevent remaining helper changes (on mass_mailing module) when mass_mailing_sms uninstalled-->
                <attribute name="help">For an Email, Subject your Recipients will see in their inbox.
                    For an SMS Text Message, internal Title of the Message.</attribute>
            </xpath>
            <xpath expr="//field[@name='subject']" position="after">
                <field name="sms_subject" string="Title" attrs="{'invisible': [('mailing_type', '!=', 'sms')], 'readonly': [('state', 'in', ('sending', 'done'))], 'required': [('mailing_type', '=', 'sms')]}"/>
            </xpath>
            <xpath expr="//field[@name='preview']" position="attributes">
                <attribute name="attrs">{'readonly': [('state', 'in', ('sending', 'done'))], 'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//page[@name='mail_body']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//page[@name='mail_body']" position="after">
                <page string="SMS Content" name="sms_body" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">
                    <field name="body_plaintext" widget="sms_widget"
                        attrs="{'required': [('mailing_type', '=', 'sms')], 'readonly': [('state', 'in', ('sending', 'done'))]}"
                        options='{"enable_emojis": True}'/>
                    <group>
                        <field name="sms_force_send" invisible="1"/>
                    </group>
                </page>
            </xpath>
            <xpath expr="//field[@name='user_id']" position="after">
                <field name="sms_allow_unsubscribe" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}"/>
            </xpath>

            <xpath expr="//field[@name='contact_list_ids']" position="attributes">
                <attribute name="context">
                    {'mailing_sms' : context.get('mailing_sms')}
                </attribute>
            </xpath>
            <!-- Option page tweaks -->
            <xpath expr="//field[@name='email_from']" position="attributes">
                <attribute name="attrs">{
                    'invisible': [('mailing_type', '!=', 'mail')],
                    'readonly': [('state', 'in', ('sending', 'done'))]}
                </attribute>
            </xpath>
            <xpath expr="//label[@for='reply_to']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//div[@name='reply_to_details']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//label[@for='attachment_ids']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//div[@name='attachment_ids_details']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//field[@name='mail_server_id']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
        </field>
    </record>

    <record id="mailing_mailing_view_form_mixed" model="ir.ui.view">
        <!-- View allowign to display the mailing type and therefore choosing
        the way of mailing: not prioritized one, used in some specific cases
        like "contacting people" without predefining mail or sms -->
        <field name="name">mailing.mailing.view.form.mixed</field>
        <field name="model">mailing.mailing</field>
        <field name="mode">primary</field>
        <field name="priority">30</field>
        <field name="inherit_id" ref="mass_mailing_sms.mailing_mailing_view_form_sms"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='mailing_type']" position="attributes">
                <attribute name="invisible">0</attribute>
            </xpath>
        </field>
    </record>

    <record id="mailing_mailing_view_kanban_sms" model="ir.ui.view">
        <field name="name">mailing.mailing.view.kanban.inherit.sms</field>
        <field name="model">mailing.mailing</field>
        <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_kanban"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='active']" position="after">
                <field name="sms_has_insufficient_credit"/>
                <field name="sms_has_unregistered_account"/>
            </xpath>
            <xpath expr="//div[@name='stat_opened']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//div[@name='stat_replied']" position="attributes">
                <attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//div[@name='div_responsible_avatar']" position="after">
                <div class="alert alert-warning mb-0 mt-3 o-hidden-ios" role="alert" attrs="{'invisible': [('sms_has_insufficient_credit', '=', False)]}">
                    <a name="action_buy_sms_credits" type="object">Insufficient credits</a>
                </div>
                <div class="alert alert-warning mb-0 mt-3" role="alert" attrs="{'invisible': [('sms_has_unregistered_account', '=', False)]}">
                    <a name="action_buy_sms_credits" type="object">Unregistered account</a>
                </div>
            </xpath>
        </field>
    </record>

    <record id="mailing_mailing_view_tree_sms" model="ir.ui.view">
        <field name="name">mailing.mailing.view.tree.sms</field>
        <field name="model">mailing.mailing</field>
        <field name="priority">20</field>
        <field name="arch" type="xml">
            <tree string="SMS Marketing" sample="1">
                <field name="subject"/>
                <field name="mailing_type" invisible="1"/>
                <field name="mailing_model_id" string="Recipients"/>
                <field name="user_id" widget="many2one_avatar_user"/>
                <field name="schedule_date" string="Scheduled" widget="remaining_days"/>
                <field name="sent_date" widget="date"/>
                <field name="state" decoration-info="state == 'draft' or state == 'in_queue'" decoration-success="state == 'sending' or state == 'done'" widget="badge"/>
                <field name="campaign_id" string="Campaign" groups="mass_mailing.group_mass_mailing_campaign"/>
                <field name="sent"/>
                <field name="clicked"/>
                <field name="bounced"/>
            </tree>
        </field>
    </record>

    <record id="mailing_mailing_action_sms" model="ir.actions.act_window">
        <field name="name">SMS Marketing</field>
        <field name="res_model">mailing.mailing</field>
        <field name="view_mode">kanban,tree,form,graph</field>
        <field name="search_view_id" ref="mailing_mailing_view_search_sms"/>
        <field name="domain">[('mailing_type', '=', 'sms')]</field>
        <field name="context">{
                'search_default_assigned_to_me': 1,
                'default_user_id': uid,
                'default_mailing_type': 'sms',
                'mailing_sms': True
        }</field>
        <field name="help" type="html">
          <p class="o_view_nocontent_smiling_face">
            Create a new SMS Marketing
          </p><p>
            You can easily send SMS to any contact saved in other Odoo apps.
          </p>
        </field>
    </record>
    <record id="mailing_mailing_action_sms_view_kanban" model="ir.actions.act_window.view">
        <field name="sequence">1</field>
        <field name="view_mode">kanban</field>
        <field name="view_id" ref="mailing_mailing_view_kanban_sms"/>
        <field name="act_window_id" ref="mailing_mailing_action_sms"/>
    </record>
    <record id="mailing_mailing_action_sms_view_tree" model="ir.actions.act_window.view">
        <field name="sequence">2</field>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="mailing_mailing_view_tree_sms"/>
        <field name="act_window_id" ref="mailing_mailing_action_sms"/>
    </record>

    <!-- SMS Marketing / SMS Marketing -->
    <record id="mass_mailing_sms_menu_mass_sms" model="ir.ui.menu">
        <field name="action" ref="mailing_mailing_action_sms"/>
    </record>

</data></odoo>