[FIX] base_import: cannot import midnight date
Steps to reproduce:
1. Install hr_attendance
2. Go to attendances
3. Select any line
4. Change the check-out date to next day
5. Change the check-out time to 00:00:00
6. Export that line, file format xlsx
7. Favorites > import records
8. Upload the exported file > Test
9. Column check_out contains incorrect values.
Error in line 2: unconverted data remains: 2023-06-11
Cause of the issue:
options.get('date_format') is empty
opw-3374883
closes odoo/odoo#136485
X-original-commit: 973af5854de4a9fa3a9f5bd3bca8c7b342ff71e9
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
@@ -1193,8 +1193,8 @@ class Import(models.TransientModel):
|
||||
def _parse_date_from_data(self, data, index, name, field_type, options):
|
||||
dt = datetime.datetime
|
||||
fmt = fields.Date.to_string if field_type == 'date' else fields.Datetime.to_string
|
||||
d_fmt = options.get('date_format')
|
||||
dt_fmt = options.get('datetime_format')
|
||||
d_fmt = options.get('date_format') or DEFAULT_SERVER_DATE_FORMAT
|
||||
dt_fmt = options.get('datetime_format') or DEFAULT_SERVER_DATETIME_FORMAT
|
||||
for num, line in enumerate(data):
|
||||
if not line[index]:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user