From d6f8042e04b0a29937d49341df48a50534f6223c Mon Sep 17 00:00:00 2001 From: Kitti U Date: Tue, 2 Apr 2019 10:36:13 +0700 Subject: [PATCH] [12.0][FIX] excel_import_export wrong use of dict.iteritems() for python3 --- excel_import_export/models/xlsx_export.py | 2 +- excel_import_export/wizard/import_xlsx_wizard.py | 2 +- excel_import_export_demo/tests/test_xlsx_import_export.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/excel_import_export/models/xlsx_export.py b/excel_import_export/models/xlsx_export.py index c7db3f928..78b9eb41f 100644 --- a/excel_import_export/models/xlsx_export.py +++ b/excel_import_export/models/xlsx_export.py @@ -244,7 +244,7 @@ class XLSXExport(models.AbstractModel): f.write(decoded_data) f.seek(0) f.close() - # Workbook created, temp fie removed + # Workbook created, temp file removed wb = load_workbook(ftemp) os.remove(ftemp) # Start working with workbook diff --git a/excel_import_export/wizard/import_xlsx_wizard.py b/excel_import_export/wizard/import_xlsx_wizard.py index 750dc17e1..49be5c07a 100644 --- a/excel_import_export/wizard/import_xlsx_wizard.py +++ b/excel_import_export/wizard/import_xlsx_wizard.py @@ -80,7 +80,7 @@ class ImportXLSXWizard(models.TransientModel): # Context testing if self._context.get('template_context', False): template_context = self._context['template_context'] - for key, value in template_context.iteritems(): + for key, value in template_context.items(): if key not in record or \ (record._fields[key].type == 'many2one' and record[key].id or record[key]) != value: diff --git a/excel_import_export_demo/tests/test_xlsx_import_export.py b/excel_import_export_demo/tests/test_xlsx_import_export.py index 64fb18525..d121c5799 100644 --- a/excel_import_export_demo/tests/test_xlsx_import_export.py +++ b/excel_import_export_demo/tests/test_xlsx_import_export.py @@ -36,7 +36,8 @@ class TestXLSXImportExport(TestExcelImportExport): 'active_id': self.sale_order.id, 'template_domain': [('res_model', '=', 'sale.order'), ('fname', '=', 'sale_order.xlsx'), - ('gname', '=', False)], } + ('gname', '=', False)], + 'template_context': {'state': 'draft'}, } with Form(self.env['import.xlsx.wizard'].with_context(ctx)) as f: f.import_file = self.export_file import_wizard = f.save()