Files
odoo_source/addons/base_import
Saurabh Choraria 85b5ddfc0d [FIX] base_import: accept single character in text delimiter
When a user tries to import the CSV file with an empty text delimiter
or more than one character in text delimiter at that time the traceback
will be generated.

Steps to reproduce:
- Install Accounting module.
- Click on import in the bank statement.
- Select any CSV file for the bank statement line or can download and import
this file - https://drive.google.com/file/d/1lnScw4RN6T01pOkyNON8vvb3FQOPiy1O/view?usp=drive_link
- Enter empty text delimiter or more than one character in text delimiter.
- Click on the test or Import button.
- Error will occur.

Error: ValueError: Unsupported file format "text/csv", import only supports
CSV, ODS, XLS and XLSX

The issue is occurring because text delimiter (options['quoting']) is used
as quotechar while reading csv file and quotechar is always a single
character string. Check here -
https://github.com/odoo/odoo/blob/0fde590bee71618f78e5f954349530bd007c62cf/addons/base_import/models/base_import.py#L494-L497

To solve this issue the length of text delimiter has been checked and if it
is not equal to one then a warning is given to the user.

sentry-4390461991

closes odoo/odoo#138638

X-original-commit: 1f4aa620779ebe6a0cb7f7ca1910080a258d6fac
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
Signed-off-by: Saurabh Choraria (sauc) <sauc@odoo.com>
2023-10-13 14:14:05 +00:00
..