From ec3a947f3bfdafbb211f3aae58aa7d5bc7e8e7a8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 24 Jan 2020 07:25:54 +0000 Subject: [PATCH] [FIX] sale: customer reference index - Create hundreds of SO with a Customer Reference set - Select them all - Click on Action Create Invoices The following error is raised: ``` psycopg2.OperationalError: index row size 5480 exceeds maximum 2712 for index "account_move_line_partner_id_ref_idx" ``` The issue is similar to c545783b95b15f65a9798003b614f75685dc434e, so is the solution. opw-2180139 closes odoo/odoo#43906 X-original-commit: dbd1858b623c5bf4c14c8de568c6addc7868b14e Signed-off-by: Nicolas Martinelli (nim) --- addons/sale/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 106e7a2e3f6..b1a1820d844 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -628,7 +628,7 @@ class SaleOrder(models.Model): payment_refs.add(invoice_vals['invoice_payment_ref']) refs.add(invoice_vals['ref']) ref_invoice_vals.update({ - 'ref': ', '.join(refs), + 'ref': ', '.join(refs)[:2000], 'invoice_origin': ', '.join(origins), 'invoice_payment_ref': len(payment_refs) == 1 and payment_refs.pop() or False, })