diff options
| author | Nicolas (vin) <vin@odoo.com> | 2021-02-22 14:01:41 +0000 |
|---|---|---|
| committer | Nicolas (vin) <vin@odoo.com> | 2021-04-21 09:34:11 +0000 |
| commit | 33a690a6a554e5f2addc7c00a3a37bdf3b691984 (patch) | |
| tree | b682b09148772c0f5628b84a611288f881569e7e /addons/snailmail_account/wizard | |
| parent | 9ac6b921c7e1918a229aeeef97890f19deac1d37 (diff) | |
[FIX] snailmail_account: avoid a traceback when validating addresses
When trying to send&print a move without partner_id, which can be done
from the tree view of the account moves, a traceback will be raised when
the address is being validated.
This change will make sure to avoid that and also shows that the adress
is not complete in the wizard if needed.
closes odoo/odoo#69590
X-original-commit: 0ce5f8617fdcf3601f937c35660563cb3c79fbbe
Signed-off-by: William André (wan) <wan@odoo.com>
Diffstat (limited to 'addons/snailmail_account/wizard')
| -rw-r--r-- | addons/snailmail_account/wizard/account_invoice_send.py | 2 | ||||
| -rw-r--r-- | addons/snailmail_account/wizard/account_invoice_send_views.xml | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/snailmail_account/wizard/account_invoice_send.py b/addons/snailmail_account/wizard/account_invoice_send.py index f09f2e91c85..ba0129d1925 100644 --- a/addons/snailmail_account/wizard/account_invoice_send.py +++ b/addons/snailmail_account/wizard/account_invoice_send.py @@ -21,7 +21,7 @@ class AccountInvoiceSend(models.TransientModel): @api.depends('invoice_ids') def _compute_invalid_addresses(self): for wizard in self: - invalid_invoices = wizard.invoice_ids.filtered(lambda i: not self.env['snailmail.letter']._is_valid_address(i.partner_id)) + invalid_invoices = wizard.invoice_ids.filtered(lambda i: not i.partner_id or not self.env['snailmail.letter']._is_valid_address(i.partner_id)) wizard.invalid_invoice_ids = invalid_invoices wizard.invalid_addresses = len(invalid_invoices) diff --git a/addons/snailmail_account/wizard/account_invoice_send_views.xml b/addons/snailmail_account/wizard/account_invoice_send_views.xml index 2ff5746b9a8..b2efb714bf6 100644 --- a/addons/snailmail_account/wizard/account_invoice_send_views.xml +++ b/addons/snailmail_account/wizard/account_invoice_send_views.xml @@ -23,7 +23,7 @@ <i class="fa fa-info-circle" role="img" aria-label="Warning" title="Make sure you have enough Stamps on your account."/> )</b> </span> - <span attrs="{'invisible': ['|', ('composition_mode', '=', 'mass_mail'), ('partner_id', '=', False)]}"> + <span attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}"> <span attrs="{'invisible': [('invalid_addresses', '!=', 0)]}"> <div class="text-right text-muted d-inline-block" name="address"> <span> to: </span> |
