From aaf5504373de1554ffebf3850c146b98f31a9cc1 Mon Sep 17 00:00:00 2001 From: Arnaud Joset Date: Fri, 31 Jan 2020 13:59:50 +0000 Subject: [PATCH] [FIX] sale: prevent trackback when makeing an SO line without product Before this fix, an empty sale order produced a traceback when the invoice was created. closes odoo/odoo#42750 Taskid: 1997415 Related: odoo/enterprise#7540 Signed-off-by: Damien Bouvy (dbo) --- addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index d7c2477b771..4516b48d47e 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -139,7 +139,7 @@ class SaleAdvancePaymentInv(models.TransientModel): 'analytic_tag_ids': analytic_tag_ids, 'tax_id': [(6, 0, tax_ids)], 'is_downpayment': True, - 'sequence': order.order_line[-1].sequence + 1 if order.order_line else 10, + 'sequence': order.order_line and order.order_line[-1].sequence + 1 or 10, } return so_values