diff --git a/netforce_clinic/actions/clinic_staff.xml b/netforce_clinic/actions/clinic_staff.xml
index b0f69a8..5b94985 100644
--- a/netforce_clinic/actions/clinic_staff.xml
+++ b/netforce_clinic/actions/clinic_staff.xml
@@ -2,7 +2,7 @@
Staffs
multi_view
clinic.staff
- [["All",[]],["Archived",[["active","=",false]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]
+ [["All",[]],["Archived",[["active","=",false]]],["Staff",[["type","=","staff"]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]
list,page,form
clinic_menu
25
diff --git a/netforce_clinic/layouts/clinic_staff_form.xml b/netforce_clinic/layouts/clinic_staff_form.xml
index 16275c5..4f7bc72 100644
--- a/netforce_clinic/layouts/clinic_staff_form.xml
+++ b/netforce_clinic/layouts/clinic_staff_form.xml
@@ -50,23 +50,8 @@
-
-
-
+
@@ -79,8 +64,22 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 290db12..2acf9be 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -914,10 +914,10 @@ class HDCase(Model):
return vals
# staff
patient=get_model("clinic.patient").browse(patient_id)
- doctor=patient.doctor_id
- if doctor:
+ if not vals.get('staffs'):
vals['staffs']=[]
- if not vals.get('staffs'):
+ doctor=patient.doctor_id
+ if doctor:
vals['staffs'].append(('create',{
'staff_id': doctor.id,
'type': 'doctor',
diff --git a/netforce_clinic/models/hd_case_staff.py b/netforce_clinic/models/hd_case_staff.py
index f6e7a1b..d345989 100644
--- a/netforce_clinic/models/hd_case_staff.py
+++ b/netforce_clinic/models/hd_case_staff.py
@@ -3,12 +3,36 @@ from netforce.model import Model, fields
class HDCaseStaff(Model):
_name="clinic.hd.case.staff"
_name_field="staff_id"
+
+ def _get_all(self,ids,context={}):
+ res={}
+ for obj in self.browse(ids):
+ hd_case=obj.hd_case_id
+ patient=hd_case.patient_id
+ res[obj.id]={
+ 'sickbed_id': hd_case.sickbed_id.id,
+ 'patient_id': patient.id,
+ 'patient_type_id': patient.type_id.id,
+ 'cycle_id': hd_case.cycle_id.id,
+ 'date': hd_case.date,
+ 'department_id': hd_case.department_id.id,
+ 'state': hd_case.state,
+ }
+ return res
+
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",required=True,on_delete="cascade"),
"staff_id": fields.Many2One("clinic.staff","Doctor",search=True),
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True),
"priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"),
'note': fields.Char("Note"),
+ 'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True),
+ 'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True),
+ 'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True),
+ 'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True),
+ 'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True),
+ 'date': fields.Date("Date",function="_get_all",function_multi=True),
+ "state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",function="_get_all",function_multi=True),
}
_defaults={
diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py
index aa3beb5..9817c2d 100644
--- a/netforce_clinic/models/staff.py
+++ b/netforce_clinic/models/staff.py
@@ -115,7 +115,7 @@ class Staff(Model):
'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
"hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"),
- "hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"),
+ "hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"), # not need to use (it's slow to load)
"cycle_item_nurses": fields.One2Many("clinic.cycle.item.nurse","nurse_id","Cycle Items"),
}
diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py
index dd1e0ad..3b2c33c 100644
--- a/netforce_clinic/models/visit.py
+++ b/netforce_clinic/models/visit.py
@@ -175,6 +175,12 @@ class Visit(Model):
dialyzer=self.get_dlz(obj.id)
vals['dialyzers'].append(('create',dialyzer))
+ vals['staffs'].append(('create',{
+ 'staff_id': obj.doctor_id.id,
+ 'type': 'doctor',
+ 'priop': 'owner',
+ }))
+
# use exist hd_case (in case set to draft)
hd_case_id=None
if obj.hd_cases:
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index 83cbf7b..848b08f 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,17 +1 @@
-=====
- - visit
- - color
- - generate
- nurses too much copy
- - access right
- - diffrent user branch
-=====
-create button reset at setting
- - backup master data
- - patient
- - staff/nurse/doctor
- - account
- - journal
- - product
- ---
-
+onclick hd case on staff