The error handling portion of on_save() is fine, but after the if errors: block, we'll start changing things:
data = self.recordform.get() try: self.data_model.save_record(data)
We no longer need to extract the row number or pass it into save_record(), and we can delete the handling of IndexError since SQLModel will not raise that exception. We also need to rewrite the updating of inserted_rows and updated_rows.
Remove all the code in this method after the call to self.status.set(), and replace it with this:
key = (data['Date'], data['Time'], data['Lab'], data['Plot']) if self.data_model.last_write == 'update': self.updated_rows.append(key) else: self.inserted_rows.append(key) self.populate_recordlist() if self.data_model.last_write ...