[FIX] mass_mailing: do not crash when importing a void contact list
Mass mailing has a wizard to import contacts from a text input. It currently
crashes when trying to import a void field, while it should not.
We fix that by two means
* make field required in view (as model cannot be modified);
* while it is not updated, simply consider a void input should not crash and
is considered as an input without valid input found;
Task-3053031
closes odoo/odoo#104769
X-original-commit: aa183fa29d609d2b608fa451ee48a35e3d1549b2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
d89359c383
commit
8aa43bd7e5
@@ -15,8 +15,7 @@ class MailingContactImport(models.TransientModel):
|
||||
def action_import(self):
|
||||
"""Import each lines of "contact_list" as a new contact."""
|
||||
self.ensure_one()
|
||||
|
||||
contacts = tools.email_split_tuples(', '.join(self.contact_list.splitlines()))
|
||||
contacts = tools.email_split_tuples(', '.join((self.contact_list or '').splitlines()))
|
||||
if not contacts:
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<label for="contact_list" class="mb-2">Contact List</label>
|
||||
<field name="contact_list" class="o_mailing_contact_import_list"
|
||||
nolabel="1" default_focus="1"
|
||||
required="True"
|
||||
placeholder='"Damien Roberts" <d.roberts@example.com> "Rick Sanchez" <rick_sanchez@example.com> victor_hugo@example.com'/>
|
||||
<p class="text-muted mb-0">
|
||||
Want to import country, company name and more?
|
||||
|
||||
Reference in New Issue
Block a user