From 464470f2afee609f6065763dbd6948986b86f4e7 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Fri, 19 Feb 2016 08:58:32 +0700 Subject: [PATCH] if no reimburse medical stock should set to CASH --- netforce_clinic/models/report_medical_summary.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py index a11bd63..66bfd0e 100644 --- a/netforce_clinic/models/report_medical_summary.py +++ b/netforce_clinic/models/report_medical_summary.py @@ -93,6 +93,9 @@ class ReportMedicalSummary(Model): if ct_ids: dom.append(['categ_id.id','in',ct_ids]) categ_ids=set() + themself_id=0 + for type_id in get_model("clinic.patient.type").search([['code','=','CASH']]): + themself_id=type_id for prod in get_model("product").search_browse(dom): prod_code=prod.code or "" categ=prod.categ_id @@ -128,7 +131,10 @@ class ReportMedicalSummary(Model): continue if categ and categ.id not in list(categ_ids): continue - products[prod_code][patient_type_id]['qty']+=line.qty + 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 lines=[] limit_char=25