From d1feb088228e1fe74c917ecdd5f4c0e87d253263 Mon Sep 17 00:00:00 2001
From: jvm-odoo <jvm@odoo.com>
Date: Tue, 5 Nov 2019 09:20:15 +0000
Subject: [PATCH] [FIX] account: fix ref when sending invoice to customer
 without email

Create a customer without email address, go on the accounting module
create an invoice for this customer.

Go back to the invoices list and select some of them including your
invoice for your customer without email address. Send them by mail.

You will have a traceback and the wizard will be broken.

This bug is caused by a change in the account module, there is no more
reference, they are replaced by the name of the invoice.

OPW-2085837

closes odoo/odoo#39738

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
---
 addons/account/wizard/account_invoice_send.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py
index ce4dab563178..d4bd9417bc2e 100644
--- a/addons/account/wizard/account_invoice_send.py
+++ b/addons/account/wizard/account_invoice_send.py
@@ -75,7 +75,7 @@ class AccountInvoiceSend(models.TransientModel):
                 if invoices:
                     wizard.invoice_without_email = "%s\n%s" % (
                         _("The following invoice(s) will not be sent by email, because the customers don't have email address."),
-                        "\n".join([i.reference for i in invoices])
+                        "\n".join([i.name for i in invoices])
                         )
                 else:
                     wizard.invoice_without_email = False
-- 
GitLab