[FIX] base_import: Don't convert properly formatted date format

When importing documents that have a `date` or a  `datetime` field
a conversion is done on the format string in case it was still in the
old moment format (e.g. YYYYMMDD).

The problem is that this conversion was done regardless if the format
string was valid or not. This was producing botched format strings that
would prevent any import having a date or datetime field with proper
format string.

closes odoo/odoo#119340

X-original-commit: 20f4102e9aef42c557c6f7e0b5b5e591a18b1b4f
Signed-off-by: Luca Vitali <luvi@odoo.com>
This commit is contained in:
Arnaud Baes
2023-04-22 05:52:09 +02:00
parent 2fb19756ef
commit cec7436b8e
@@ -98,7 +98,7 @@ export class BaseImportModel {
name_create_enabled_fields: {},
};
for (const [name, option] of Object.entries(this.importOptionsValues)) {
tempImportOptions[name] = ['date_format', 'datetime_format'].includes(name)
tempImportOptions[name] = ['date_format', 'datetime_format'].includes(name) && !option.value.includes('%')
? moment_to_strftime_format(option.value)
: option.value;
}