from netforce.model import get_model from netforce import migration from netforce.access import set_active_user, set_active_company class Migration(migration.Migration): _name="clinic.repos.invoice" _version="2.10.0" def migrate(self): set_active_user(1) set_active_company(1) for hdcase_line in get_model('clinic.hd.case.line').search_browse([['description','=',None]]): prod=hdcase_line.product_id if prod: hdcase_line.write({ 'description': prod.name, }) for hdcase in get_model('clinic.hd.case').search_browse([]): for inv in hdcase.invoices: if inv.state=='waiting_payment': print('hdcase:repost ---> ', inv.number) inv.to_draft() inv.write({ 'hdcase_reconcile': True, }) inv.post() for shop in get_model('clinic.shop').search_browse([]): for inv in shop.invoices: print('shop:repost ---> ', inv.number) inv.to_draft() inv.write({ 'hdcase_reconcile': True, }) inv.post() print("Done!") return True Migration.register()