2014-09-22 11:36:00 +00:00
|
|
|
from netforce.model import get_model
|
|
|
|
from netforce import migration
|
|
|
|
|
|
|
|
class Migration(migration.Migration):
|
|
|
|
_name="clinic.setting"
|
|
|
|
_version="1.180.0"
|
|
|
|
|
|
|
|
def migrate(self):
|
|
|
|
res=get_model("clinic.setting").search([])
|
2014-10-08 09:00:26 +00:00
|
|
|
if not res:
|
|
|
|
get_model("clinic.setting").create({})
|
|
|
|
|
|
|
|
seq_names=[
|
|
|
|
('HDC-','Clinic HD Case'),
|
|
|
|
('VS-', 'Clinic Visit'),
|
2014-10-29 09:10:19 +00:00
|
|
|
('PS-', 'Clinic Personal'),
|
2014-10-08 09:00:26 +00:00
|
|
|
('PT-', 'Clinic Patient'),
|
|
|
|
('DT-', 'Clinic Doctor'),
|
|
|
|
('NS-', 'Clinic Nurse'),
|
|
|
|
]
|
|
|
|
for prefix, seq_name in seq_names:
|
|
|
|
seq_ids=get_model('sequence').search([['name','=',seq_name]])
|
|
|
|
if not seq_ids:
|
|
|
|
get_model("sequence").create({
|
|
|
|
'prefix': prefix,
|
|
|
|
'name': seq_name,
|
|
|
|
'type': 'other',
|
|
|
|
})
|
|
|
|
print("create seq %s successfully " % seq_name)
|
2014-10-29 09:10:19 +00:00
|
|
|
# insert into clinic_personal(number,name,type, state,picture, active) select number, name,'doctor','temporary', picture, true from clinic_doctor;
|
2014-10-08 09:00:26 +00:00
|
|
|
return
|
2014-09-22 11:36:00 +00:00
|
|
|
|
|
|
|
Migration.register()
|