Browse Source

[12.0][FIX] excel_import_export

wrong use of dict.iteritems() for python3
pull/1536/head
Kitti U 6 years ago
parent
commit
d6f8042e04
  1. 2
      excel_import_export/models/xlsx_export.py
  2. 2
      excel_import_export/wizard/import_xlsx_wizard.py
  3. 3
      excel_import_export_demo/tests/test_xlsx_import_export.py

2
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

2
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:

3
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()

Loading…
Cancel
Save