From 1e5fbb8e5bf0e0458d83a399b2b59d03a601e86a Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Thu, 25 Apr 2019 19:39:23 +0000 Subject: [PATCH] [FIX] sale: ensure Down Payment product exists In case the Down Payment product is removed/not accessible, trying to create a down payment from a sale order to invoice produced an error "Record does not exist or has been deleted. (Records: [42], User: 2)" Add a exists for returning an empty recordset for a better fallback and create a new Down Payment product using the wizard closes odoo/odoo#32965 Signed-off-by: Martin Trigaux (mat) --- 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 ee85807201d..193ae90d360 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -30,7 +30,7 @@ class SaleAdvancePaymentInv(models.TransientModel): @api.model def _default_product_id(self): product_id = self.env['ir.config_parameter'].sudo().get_param('sale.default_deposit_product_id') - return self.env['product.product'].browse(int(product_id)) + return self.env['product.product'].browse(int(product_id)).exists() @api.model def _default_deposit_account_id(self):