Hi all,
I want to create a custom wizard that imports a csv and then compares this data to the data that is already in the database. I then want to select to keep the data, replace or delete the data. i am currently on Odoo8.
I currently have:
class ExcelImport(models.TransientModel):
_name = 'excell.import.wizard'
excel_file_for_import = fields.Binary(string='File for upload')
def import_data_form_file(self):
try:
inputx = StringIO.StringIO()
inputx.write(base64.decodestring(self.excel_file_for_import))
book = open_workbook(file_contents=inputx.getvalue())
except TypeError as e:
raise ValidationError(u'ERROR: {}'.format(e))
sheet = book.sheets()[0]
for i in range(sheet.nrows):
if i == 0:
continue
if i == 1:
name = sheet.cell(i, 0).value
vat = sheet.cell(i, 5).value