[IMP] sms: sms composer promenade
Before this Commit, There is an extra space at the top of the SMS composer. After this Commit, we have improved the UX of the SMS composer. 1/ Remove additional space on top of the SMS composer. 2/ Remove the additional space below the validation message. 3/ Improve the validation message of the invalid phone number. Task-2710478 closes odoo/odoo#83062 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -35,6 +35,7 @@ class SendSMS(models.TransientModel):
|
||||
('mass', 'Send SMS in batch')], string='Composition Mode',
|
||||
compute='_compute_composition_mode', precompute=True, readonly=False, required=True, store=True)
|
||||
res_model = fields.Char('Document Model Name')
|
||||
res_model_description = fields.Char('Document Model Description', compute='_compute_res_model_description')
|
||||
res_id = fields.Integer('Document ID')
|
||||
res_ids = fields.Char('Document IDs')
|
||||
res_ids_count = fields.Integer(
|
||||
@@ -76,6 +77,12 @@ class SendSMS(models.TransientModel):
|
||||
else:
|
||||
composer.composition_mode = 'comment'
|
||||
|
||||
@api.depends('res_model')
|
||||
def _compute_res_model_description(self):
|
||||
self.res_model_description = False
|
||||
for composer in self.filtered('res_model'):
|
||||
composer.res_model_description = self.env['ir.model']._get(composer.res_model).display_name
|
||||
|
||||
@api.depends('res_model', 'res_id', 'res_ids')
|
||||
def _compute_res_ids_count(self):
|
||||
for composer in self:
|
||||
|
||||
@@ -5,6 +5,25 @@
|
||||
<field name="model">sms.composer</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Send an SMS">
|
||||
<!-- Single mode information (invalid number) -->
|
||||
<div colspan="2" class="alert alert-danger text-center mb-0" role="alert"
|
||||
attrs="{'invisible': ['|', '|', ('res_model_description', '=', False), ('comment_single_recipient', '=', False), ('recipient_single_valid', '=', True)]}">
|
||||
<p class="my-0">
|
||||
<strong>Invalid number:</strong>
|
||||
<span> make sure to set a country on the </span>
|
||||
<span><field name="res_model_description"/></span>
|
||||
<span> or to specify the country code.</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Mass mode information (res_ids versus active domain) -->
|
||||
<div colspan="2" class="alert alert-info text-center mb-0" role="alert"
|
||||
attrs="{'invisible': ['|', ('comment_single_recipient', '=', True), ('recipient_invalid_count', '=', 0)]}">
|
||||
<p class="my-0">
|
||||
<field class="oe_inline font-weight-bold" name="recipient_invalid_count"/> out of
|
||||
<field class="oe_inline font-weight-bold" name="res_ids_count"/> recipients have an invalid phone number and will not receive this text message.
|
||||
</p>
|
||||
</div>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="composition_mode" invisible="1"/>
|
||||
@@ -19,21 +38,6 @@
|
||||
<field name="numbers" invisible="1"/>
|
||||
<field name="sanitized_numbers" invisible="1"/>
|
||||
|
||||
<!-- Single mode information (invalid number) -->
|
||||
<div colspan="2" class="alert alert-danger text-center mb-3" role="alert"
|
||||
attrs="{'invisible': ['|', ('comment_single_recipient', '=', False), ('recipient_single_valid', '=', True)]}">
|
||||
<p class="my-0">Invalid phone number</p>
|
||||
</div>
|
||||
|
||||
<!-- Mass mode information (res_ids versus active domain) -->
|
||||
<div colspan="2" class="alert alert-info text-center mb-3" role="alert"
|
||||
attrs="{'invisible': ['|', ('comment_single_recipient', '=', True), ('recipient_invalid_count', '=', 0)]}">
|
||||
<p class="my-0">
|
||||
<field class="oe_inline font-weight-bold" name="recipient_invalid_count"/> out of
|
||||
<field class="oe_inline font-weight-bold" name="res_ids_count"/> recipients have an invalid phone number and will not receive this text message.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<label for="recipient_single_description" string="Recipient"
|
||||
class="font-weight-bold"
|
||||
attrs="{'invisible': [('comment_single_recipient', '=', False)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user