diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml
index eb47321..faf76f0 100644
--- a/netforce_clinic/layouts/clinic_patient_form.xml
+++ b/netforce_clinic/layouts/clinic_patient_form.xml
@@ -3,8 +3,6 @@
diff --git a/netforce_clinic/models/address.py b/netforce_clinic/models/address.py
index df8c8a1..92d2c6b 100644
--- a/netforce_clinic/models/address.py
+++ b/netforce_clinic/models/address.py
@@ -4,6 +4,8 @@ class Address(Model):
_inherit="address"
_fields={
'fax': fields.Char("Fax"),
+ 'patient_id': fields.Many2One("clinic.patient", "Patient"),
+ "staff_id": fields.Many2One("clinic.staff","Staff"),
}
Address.register()
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index 97c1394..de3b5ff 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -142,12 +142,12 @@ class Patient(Model):
"partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
"active":fields.Boolean("Active"),
- "dispose":fields.Boolean("Dispose"),
+ "dispose":fields.Boolean("Dispose",search=True),
'note': fields.Text("Note"),
'categ_id': fields.Many2One("clinic.patient.categ","Category"),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
"documents": fields.One2Many("document","related_id","Documents"),
- 'resign_date': fields.Date("Dispose Date"),
+ 'resign_date': fields.Date("Dispose Date", search=True),
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
'department_id': fields.Many2One("clinic.department","Department",search=True),
'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"),
@@ -223,7 +223,7 @@ class Patient(Model):
if res.get("department_ids"):
dpt_ids=res['department_ids']
else:
- dpt_ids=res['department_id']
+ dpt_ids=[res['department_id']]
dpts=get_model("clinic.department").browse(dpt_ids)
code=','.join([dpt.code for dpt in dpts])
return code
@@ -249,6 +249,7 @@ class Patient(Model):
'departments': _get_departments,
'location': _get_default_location,
'nation_id': _get_nation,
+ 'dispose': False,
}
_sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"),
diff --git a/netforce_clinic/models/report_hd_case_summary.py b/netforce_clinic/models/report_hd_case_summary.py
index c955b28..72f91bf 100644
--- a/netforce_clinic/models/report_hd_case_summary.py
+++ b/netforce_clinic/models/report_hd_case_summary.py
@@ -99,6 +99,8 @@ class ReportHDCaseSummary(Model):
return dom
def replace_quote(dom=""):
+ dom=dom.replace("False","false") #XXX
+ dom=dom.replace("True","true") #XXX
return dom.replace("'","\"")
count=1
@@ -127,6 +129,8 @@ class ReportHDCaseSummary(Model):
weekday, prev_total_day=monthrange(prev_year, prev_month)
time_stop='%s-%s-%s'%(prev_year,str(prev_month).zfill(2),prev_total_day)
dom.append(['reg_date','<=',time_stop])
+ dom.append(['walkin','=',"no"])
+ dom.append(['dispose','=',False])
if branch_id:
dom.append(['branch_id','=',branch_id])
if department_id:
@@ -148,6 +152,8 @@ class ReportHDCaseSummary(Model):
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
dom.append(['reg_date','>=',time_start])
dom.append(['reg_date','<=',time_stop])
+ dom.append(['walkin','=',"no"])
+ dom.append(['dispose','=',False])
if branch_id:
dom.append(['branch_id','=',branch_id])
if department_id:
@@ -168,6 +174,8 @@ class ReportHDCaseSummary(Model):
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
dom.append(['resign_date','>=',time_start])
dom.append(['resign_date','<=',time_stop])
+ dom.append(['walkin','=',"no"])
+ dom.append(['dispose','=',True])
if branch_id:
dom.append(['branch_id','=',branch_id])
if department_id:
@@ -177,14 +185,12 @@ class ReportHDCaseSummary(Model):
for pt in get_model('clinic.patient').search_browse(dom):
resign_patients_qty+=1
resign_patients.append(pt.name)
-
- del dom[-1]
dom=replace_quote('%s'%dom)
items['topic%s'%count]={
'month': month_str,
'qty': resign_patients_qty,
'action': 'clinic_patient',
- 'action_options': 'mode=list&search_domain=%s&tab_no=2'%dom,
+ 'action_options': 'mode=list&search_domain=%s&tab_no=3'%dom,
}
count+=1
# all patient who are in hospital on select month
@@ -196,6 +202,8 @@ class ReportHDCaseSummary(Model):
dom.append(['branch_id','=',branch_id])
if department_id:
dom.append(['department_id','=',department_id])
+ dom.append(['walkin','=',"no"])
+ dom.append(['dispose','=',False])
total_patient=get_model('clinic.patient').search_browse(dom)
dom=replace_quote('%s'%dom)
total_patient_qty=len(total_patient) or 0
@@ -223,16 +231,22 @@ class ReportHDCaseSummary(Model):
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
dom.append(['reg_date','<=',time_stop])
dom.append(['type_id','=',ptype['id']])
- dom.append(['name','not in', resign_patients])
+ if branch_id:
+ dom.append(['branch_id','=',branch_id])
+ if department_id:
+ dom.append(['department_id','=',department_id])
+ dom.append(['walkin','=',"no"])
+ dom.append(['dispose','=',False])
npatients_qty=0
for pt in get_model("clinic.patient").search(dom):
npatients_qty+=1
dom=replace_quote('%s'%dom)
+ print(">>> <<< ", dom)
items[tkey]={
'month': '',
'qty': npatients_qty,
'action': 'clinic_patient',
- 'action_options': 'mode=list&search_domain=%s'%dom,
+ 'action_options': 'mode=list&tab_no=0&search_domain=%s'%dom,
}
count+=1
@@ -306,5 +320,4 @@ class ReportHDCaseSummary(Model):
}
}
-
ReportHDCaseSummary.register()
diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py
index d021dc9..eb87b82 100644
--- a/netforce_clinic/models/staff.py
+++ b/netforce_clinic/models/staff.py
@@ -206,7 +206,7 @@ class Staff(Model):
if res.get("department_ids"):
dpt_ids=res['department_ids']
else:
- dpt_ids=res['department_id']
+ dpt_ids=[res['department_id']]
dpts=get_model("clinic.department").browse(dpt_ids)
code=','.join([dpt.code for dpt in dpts])
return code