diff --git a/netforce_clinic/models/report_medical_detail.py b/netforce_clinic/models/report_medical_detail.py index 45fbaf0..624ed08 100644 --- a/netforce_clinic/models/report_medical_detail.py +++ b/netforce_clinic/models/report_medical_detail.py @@ -103,7 +103,9 @@ class ReportMedicalDetail(Model): shop_dom.append(['shop_id.branch_id','=',branch_id]) if department_id: dom.append(['hd_case_id.department_id','=',department_id]) + dom.append(['hd_case_id.patient_id.department_id','=',department_id]) shop_dom.append(['shop_id.department_id','=',department_id]) + shop_dom.append(['shop_id.patient_id.department_id','=',department_id]) st=get_model("clinic.setting").browse(1) ct_ids=[] for categ in st.product_categ_view: @@ -122,6 +124,7 @@ class ReportMedicalDetail(Model): dom.append(["hd_case_id.state","not in",["waiting_payment","paid"]]) lines=[] total_qty=0 + print('DOM ', dom) for line in get_model('clinic.hd.case.line').search_browse(dom): hdcase=line.hd_case_id patient=hdcase.patient_id diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py index dd30a9a..b7cfddb 100644 --- a/netforce_clinic/models/report_medical_summary.py +++ b/netforce_clinic/models/report_medical_summary.py @@ -87,6 +87,7 @@ class ReportMedicalSummary(Model): ['date','>=',time_start], ['date','<=',time_stop], ['department_id','=',department_id], + ['patient_id.department_id','=',department_id], ['branch_id','=',branch_id], ] dom.append(['type','=','stock']) @@ -122,6 +123,7 @@ class ReportMedicalSummary(Model): dom.append(['branch_id','=',branch_id]) if department_id: dom.append(['department_id','=',department_id]) + dom.append(['patient_id.department_id','=',department_id]) if report_type=='completed': dom.append(["state","in",["waiting_payment","paid"]]) else: @@ -136,10 +138,11 @@ class ReportMedicalSummary(Model): continue if categ and categ.id not in list(categ_ids): continue - if themself_id and patient_type_id!=themself_id and line.reimbursable=='no': - products[prod_code][themself_id]['qty']+=line.qty - else: - products[prod_code][patient_type_id]['qty']+=line.qty + #This will be combine to cash payment. To know CHECK WITH P Moo + #if themself_id and patient_type_id!=themself_id and line.reimbursable=='no': + #products[prod_code][themself_id]['qty']+=line.qty + #else: + products[prod_code][patient_type_id]['qty']+=line.qty # add qty from rd shop for shop in get_model("clinic.shop").search_browse(shop_dom):