diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2019-05-17 07:46:54 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2019-05-17 07:46:54 +0000 |
| commit | c545783b95b15f65a9798003b614f75685dc434e (patch) | |
| tree | c96f4edbea53759cdd2febfaef7ca93b01a61af3 /addons | |
| parent | 3cf9cfc985950c30c6b76480f77f5ffe53650b24 (diff) | |
[FIX] account: communication size
- Create 5 vendor bills with a long reference (> 1000 characters), for
the same partner.
- Select the bills and register a payment
An error arise: 'psycopg2.OperationalError: index row size 3256 exceeds
maximum 2712 for index "account_move_line_partner_id_ref_idx"'.
As mentioned, the index row size limit is 2712 bytes, which is exceeded
in that use case. Indeed, the reference of the payment is computed based
on the vendor reference of all bills.
We limit the number of characters to 2000. This seems reasonable knowing
that UTF-8 characters use sequences of 1 to 4 bytes [1]. Characters with
a code less than 128 require 1 byte only, and it is expected that most
vendor references will only use these characters. It is indeed unlikely
that special characters (such as Chinese characters, taking up to 4
bytes) are used for such references.
[1] https://tools.ietf.org/html/rfc3629
opw-1998823
closes odoo/odoo#33457
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_payment.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 3ba36b049a6..adca204ce3e 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -115,7 +115,7 @@ class account_abstract_payment(models.AbstractModel): 'payment_type': total_amount > 0 and 'inbound' or 'outbound', 'partner_id': False if multi else invoices[0].commercial_partner_id.id, 'partner_type': False if multi else MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].type], - 'communication': ' '.join([ref for ref in invoices.mapped('reference') if ref]), + 'communication': ' '.join([ref for ref in invoices.mapped('reference') if ref])[:2000], 'invoice_ids': [(6, 0, invoices.ids)], 'multi': multi, }) |
