From 33a690a6a554e5f2addc7c00a3a37bdf3b691984 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Mon, 22 Feb 2021 14:01:41 +0000 Subject: [FIX] snailmail_account: avoid a traceback when validating addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/snailmail_account/wizard/account_invoice_send.py | 2 +- 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 @@ ) - +
to: -- cgit v1.2.3