diff --git a/netforce_clinic/layouts/clinic_staff_form.xml b/netforce_clinic/layouts/clinic_staff_form.xml
index 30411c6..75073c1 100644
--- a/netforce_clinic/layouts/clinic_staff_form.xml
+++ b/netforce_clinic/layouts/clinic_staff_form.xml
@@ -85,20 +85,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/netforce_clinic/models/cycle_item_line.py b/netforce_clinic/models/cycle_item_line.py
index 729899a..d838077 100644
--- a/netforce_clinic/models/cycle_item_line.py
+++ b/netforce_clinic/models/cycle_item_line.py
@@ -1,4 +1,5 @@
from netforce.model import Model, fields
+from netforce.access import get_active_user, set_active_user
class CycleItemLine(Model):
_name="clinic.cycle.item.line"
@@ -6,6 +7,8 @@ class CycleItemLine(Model):
def _get_all(self,ids,context={}):
res={}
+ user_id=get_active_user()
+ set_active_user(1)
for obj in self.browse(ids):
citem=obj.cycle_item_id
pt_total=len([hdcase for hdcase in citem.hd_cases if hdcase.state in ('waiting_payment','paid')])
@@ -13,6 +16,7 @@ class CycleItemLine(Model):
'cstate': citem.state,
'pt_total': pt_total,
}
+ set_active_user(user_id)
return res
_fields={
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 35a64b8..f8ba59c 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -1458,8 +1458,6 @@ class HDCase(Model):
vals=self.get_hct(vals,patient_id)
new_id=super().create(vals,**kw)
self.function_store([new_id])
- #obj=self.browse(new_id)
- #self.check_hct(obj)
return new_id
def check_hct(self,obj):
diff --git a/netforce_clinic/models/labor_cost.py b/netforce_clinic/models/labor_cost.py
index b55bce8..61a8f69 100644
--- a/netforce_clinic/models/labor_cost.py
+++ b/netforce_clinic/models/labor_cost.py
@@ -410,7 +410,6 @@ class LaborCost(Model):
doctor_lines.append(('create',line))
else:
nurse_lines.append(('create',line))
-
obj.write({
'doctor_lines': doctor_lines,
'nurse_lines': nurse_lines,
diff --git a/netforce_clinic/models/labor_cost_line.py b/netforce_clinic/models/labor_cost_line.py
index 4907889..cba0634 100644
--- a/netforce_clinic/models/labor_cost_line.py
+++ b/netforce_clinic/models/labor_cost_line.py
@@ -31,7 +31,7 @@ class LaborCostLine(Model):
_fields={
"labor_cost_id": fields.Many2One("clinic.labor.cost","Labor Cost",required=True,on_delete="cascade"),
- "type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Staff Type",required=True,search=True,function="_get_store",function_multi=True),
+ "type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Staff Type",required=True,search=True,function="_get_store",function_multi=True,store=True),
'staff_id': fields.Many2One("clinic.staff", "Staff",search=True),
'level_id': fields.Many2One("clinic.staff.level", "Level",search=True),
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True),
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index becc123..e05be52 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -175,7 +175,7 @@ class Patient(Model):
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walkin"),
- 'department_names': fields.Text("Departments",function="_get_department_names"),
+ #'department_names': fields.Text("Departments",function="_get_department_names"),
'location': fields.Char("Location"), #to filter
}
diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py
index dd5c08e..57b4196 100644
--- a/netforce_clinic/models/staff.py
+++ b/netforce_clinic/models/staff.py
@@ -99,8 +99,12 @@ class Staff(Model):
def _get_location(self,ids,context={}):
res={}
+ user_id=get_active_user()
+ set_active_user(1)
for obj in self.browse(ids):
- res[obj.id]=",".join([d.code for d in obj.departments])
+ st_codes=set([d.code for d in obj.departments])
+ res[obj.id]=",".join([dcode for dcode in sorted(st_codes)])
+ set_active_user(user_id)
return res
def _get_department_names(self,ids,context={}):
@@ -108,26 +112,11 @@ class Staff(Model):
user_id=get_active_user()
set_active_user(1)
for obj in self.browse(ids):
- res[obj.id]=','.join([dpt.name for dpt in obj.departments])
+ dpt_st=set([dpt.name for dpt in obj.departments])
+ res[obj.id]=','.join([dpt_name for dpt_name in sorted(dpt_st)])
set_active_user(user_id)
return res
- def _get_all(self,ids,context={}):
- res={}
- for obj in self.browse(ids):
- pt_ids=[]
- if obj.type=='doctor':
- pt_ids=get_model("clinic.patient").search([['doctor_id','=',obj.id]])
- elif obj.type=='nurse':
- p=set()
- for cline in obj.cycle_item_lines:
- citem=cline.cycle_item_id
- for hdcase in citem.hd_cases:
- p.update({hdcase.patient_id.id})
- pt_ids=list(p)
- res[obj.id]=pt_ids
- return res
-
_fields={
'employee_id': fields.Many2One("hr.employee","Employee"),
"number": fields.Char("Number",required=True,search=True),
@@ -154,8 +143,6 @@ class Staff(Model):
"prof_license_expiry" : fields.Date("Expired License"),
"birthday": fields.Date("BirthDay",search=True),
"department_id": fields.Many2One("clinic.department", "Department",search=True),
- #"patients": fields.One2Many("clinic.patient","doctor_id","Patients"),
- "patients": fields.Many2Many("clinic.patient","Patients",function="_get_all"),
"addresses": fields.One2Many("address","staff_id","Addresses"),
"comments": fields.One2Many("message","related_id","Comments"),
"nurse_visits": fields.One2Many("clinic.visit","nurse_id","Visits"),
diff --git a/netforce_clinic/templates/clinic_page.hbs b/netforce_clinic/templates/clinic_page.hbs
index 2d53b83..c4ce238 100644
--- a/netforce_clinic/templates/clinic_page.hbs
+++ b/netforce_clinic/templates/clinic_page.hbs
@@ -75,12 +75,6 @@
-
-
{{t "HD Cases"}}