diff --git a/netforce_clinic/layouts/clinic_dialyzer_form.xml b/netforce_clinic/layouts/clinic_dialyzer_form.xml
index 3dc7190..faa3a0d 100644
--- a/netforce_clinic/layouts/clinic_dialyzer_form.xml
+++ b/netforce_clinic/layouts/clinic_dialyzer_form.xml
@@ -3,7 +3,7 @@
diff --git a/netforce_clinic/layouts/clinic_make_apt.xml b/netforce_clinic/layouts/clinic_make_apt.xml
index c656474..9f2371d 100644
--- a/netforce_clinic/layouts/clinic_make_apt.xml
+++ b/netforce_clinic/layouts/clinic_make_apt.xml
@@ -3,9 +3,9 @@
-
-
-
+
+
+
diff --git a/netforce_clinic/models/cycle_item.py b/netforce_clinic/models/cycle_item.py
index d68062c..d251b08 100644
--- a/netforce_clinic/models/cycle_item.py
+++ b/netforce_clinic/models/cycle_item.py
@@ -139,7 +139,7 @@ class CycleItem(Model):
nurse_id=line['nurse_id']
nurse=get_model('clinic.staff').browse(nurse_id)
line['level_id']=nurse.level_id.id
- line['categ_id']=nurse.categ_id.id
+ line['categ_id']=nurse.categ_id #XXX
return data
def view_schedule(self,ids,context={}):
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index 64d3552..ea762e8 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -55,9 +55,9 @@ class Patient(Model):
if obj.last_name:
name+=obj.last_name or ""
if not obj.active:
- name+='not_use'
+ name+='__'
elif context.get('active'):
- name+='not_use'
+ name+='__'
res[obj.id]={
'name': name,
'name_check': name.replace(" ",""), # remove all space for make sure
diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py
index d3630c9..0f1a3bb 100644
--- a/netforce_clinic/models/setting.py
+++ b/netforce_clinic/models/setting.py
@@ -126,18 +126,46 @@ class ClinicSetting(Model):
if user_id !=1:
print("Only admin!!")
return
- for pt in get_model("clinic.patient").search_browse([]):
- dates=[]
- print("="*50)
- for visit in pt.visits:
- if visit.state=='confirmed':
- continue
- if visit.visit_date in dates:
- print(pt.name, ' delete ', visit.visit_date)
- visit.to_draft()
- visit.delete()
- dates.append(visit.visit_date)
- print("="*50)
+ for citem in get_model("clinic.cycle.item").search_browse([]):
+ for line in citem.lines:
+ nurse=line.nurse_id
+ categ_id=nurse.categ_id.id
+ level_id=nurse.level_id
+ line.write({
+ 'categ_id': categ_id,
+ 'level_id': level_id,
+ })
+ print("Done!")
+ return
+ # run below before above!
+ import csv
+ f=open("/tmp/update_rotation.csv","r")
+ rd=csv.reader(f)
+ headers=next(rd)
+ headers=[h.lower().replace(" ","") for h in headers]
+ lines=[]
+ for row in rd:
+ vals=dict(zip(headers,row))
+ lines.append(vals)
+ levels={}
+ for level in get_model("clinic.staff.level").search_read([]):
+ levels[level['name']]=level['id']
+ categories={}
+ for categ in get_model("clinic.staff.categ").search_read([]):
+ categories[categ['name']]=categ['id']
+ for line in lines:
+ db_id=int(line['databaseid'])
+ level=line['level']
+ level_id=levels.get(level,None)
+ catetory=line['category']
+ categ_id=categories.get(catetory,None)
+ rt=get_model('clinic.staff.rotation').browse(db_id)
+ rt.write({
+ 'level_id': level_id,
+ 'categ_id': categ_id,
+ })
+ #print(line)
+
print("Done!")
return
diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py
index a8375e5..f0b9683 100644
--- a/netforce_clinic/models/staff.py
+++ b/netforce_clinic/models/staff.py
@@ -37,17 +37,20 @@ class Staff(Model):
max_cycle=0
ot_per_cycle=0
level_id=None
+ categ_id=None
for rotate in obj.rotations:
if rotate.state=='approved':
level_id=rotate.level_id.id
wage=rotate.wage
max_cycle=rotate.max_cycle
ot_per_cycle=rotate.ot_per_cycle or 0
+ categ_id=rotate.categ_id.id
res[obj.id]={
'wage': wage,
'max_cycle': max_cycle,
'ot_per_cycle': ot_per_cycle,
'level_id': level_id,
+ 'categ_id': categ_id,
}
return res
@@ -82,9 +85,9 @@ class Staff(Model):
if obj.last_name:
name+=obj.last_name or ""
if not obj.active:
- name+='not_use'
+ name+='__'
elif context.get('active'):
- name+='not_use'
+ name+='__'
res[obj.id]={
'name': name,
'name_check': name.replace(" ",""), # remove all space for make sure
@@ -126,7 +129,7 @@ class Staff(Model):
"user_id": fields.Many2One("base.user","User",search=True),
'image': fields.File("Image"),
'note': fields.Text("Note"),
- 'categ_id': fields.Many2One("clinic.staff.categ", "Category",search=True),
+ 'categ_id': fields.Many2One("clinic.staff.categ", "Category",function="_get_rotation",function_multi=True),
'level_id': fields.Many2One("clinic.staff.level", "Level", function="_get_rotation",function_multi=True),
'active': fields.Boolean("Active"),
'date': fields.Date("Register Date"),