From 96a6d721f90d0947850b2a779d7ff845ad52f66a Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Fri, 8 May 2015 08:09:12 +0700 Subject: [PATCH] improve report medical summary --- netforce_clinic/layouts/clinic_prod_form.xml | 3 +++ netforce_clinic/layouts/clinic_setting.xml | 4 ++++ netforce_clinic/models/patient.py | 2 +- netforce_clinic/models/product.py | 1 + netforce_clinic/models/report_medical_summary.py | 4 +--- netforce_clinic/models/setting.py | 8 ++++---- netforce_clinic/models/visit_board.py | 6 ++++++ 7 files changed, 20 insertions(+), 8 deletions(-) diff --git a/netforce_clinic/layouts/clinic_prod_form.xml b/netforce_clinic/layouts/clinic_prod_form.xml index ed2a5e8..5d037ab 100644 --- a/netforce_clinic/layouts/clinic_prod_form.xml +++ b/netforce_clinic/layouts/clinic_prod_form.xml @@ -2,4 +2,7 @@ + + + diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml index 6fb2b83..b33ff9e 100644 --- a/netforce_clinic/layouts/clinic_setting.xml +++ b/netforce_clinic/layouts/clinic_setting.xml @@ -2,15 +2,19 @@ + diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index 5e3e654..aa86eb1 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -275,7 +275,7 @@ class Patient(Model): } _sql_constraints=("clinic_patient_key_uniq","unique(name_check)","name should be unique"), - _order="reg_date desc" + #_order="reg_date desc" def check_idcard(self,card_type,idcard=''): res=True diff --git a/netforce_clinic/models/product.py b/netforce_clinic/models/product.py index a1c38ab..4946d91 100644 --- a/netforce_clinic/models/product.py +++ b/netforce_clinic/models/product.py @@ -5,6 +5,7 @@ class Product(Model): _fields={ 'patient_types': fields.Many2Many("clinic.patient.type","Patient Types"), 'departments': fields.One2Many('clinic.department.product','product_id','Departments'), + 'report_visible': fields.Boolean("Report Visible"), } Product.register() diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py index ba3c65d..4382ffb 100644 --- a/netforce_clinic/models/report_medical_summary.py +++ b/netforce_clinic/models/report_medical_summary.py @@ -85,6 +85,7 @@ class ReportMedicalSummary(Model): dom=[] dom.append(['type','=','stock']) + dom.append(['report_visible','=',True]) if prod_categ_id: dom.append(['categ_id.id','child_of',prod_categ_id]) categ_ids=set() @@ -202,9 +203,6 @@ class ReportMedicalSummary(Model): elif branch_id: branch=get_model("clinic.branch").browse(branch_id) sub_name="(%s)" % branch.name or "" - from pprint import pprint - for line in lines: - pprint(line) data={ 'company_name': '%s %s' % (company.name or "", sub_name), 'parent_company_name': company.parent_id.name or "", diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 72b71d7..2aaad60 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -161,10 +161,10 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return - for pv in get_model("province").search_browse([]): - name=(pv.name or "")[0:1] - pv.write({ - 'sort_name': name, + categ_ids=get_model('product.categ').search([['parent_id.code','=','MDC']]) + for prod in get_model("product").search_browse([['categ_id','in',categ_ids]]): + prod.write({ + 'report_visible': True, }) #for dt in get_model("district").search_browse([]): #name=(dt.name or "")[0:1] diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index 84779e8..0eba76f 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -95,6 +95,8 @@ class VisitBoard(Model): department_id=obj.department_id.id branch_id=obj.branch_id.id def auto_gen_visit(dom=[]): + dom.append(['dispose','=',False]) + dom.append(['walkin','=','no']) def daterange(start_date, end_date): for n in range(int ((end_date - start_date).days)): yield start_date + timedelta(n) @@ -110,6 +112,10 @@ class VisitBoard(Model): for date in daterange(convert_date(date_from),convert_date(date_to)+timedelta(days=1)): weekday=date.weekday() date_txt=date.strftime("%Y-%m-%d") + datenow=time.strftime("%Y-%m-%d") + if date_txt < datenow: + print("continue ", date_txt, datenow) + continue for pt in get_model("clinic.patient").search_browse(dom): for pc in pt.cycles: w=DAYS.get(pc.day,0) #default monday