import csv import xlrd from netforce.model import get_model from netforce import migration from netforce.access import set_active_user, set_active_company from netforce.database import get_connection class Migration(migration.Migration): _name="clinic.revise" _version="2.12.6" def migrate(self): set_active_user(1) for hdcase in get_model('clinic.hd.case').search_browse([]): if not hdcase.patient_name and hdcase.patient_id: hdcase.write({ 'patient_name': hdcase.patient_id.name_get()[-1][1], }) Migration.register()