From b7162e64df26486fb305f5df5d8c27fcc2af373d Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 5 Nov 2014 14:10:03 +0700 Subject: [PATCH] refactor --- netforce_clinic/actions/clinic_schedule.xml | 2 +- netforce_clinic/actions/clinic_translate.xml | 7 - netforce_clinic/layouts/clinic_menu.xml | 2 +- .../layouts/clinic_translate_form.xml | 4 - .../layouts/clinic_translate_list.xml | 4 - netforce_clinic/models/__init__.py | 2 - .../models/report_hd_case_detail.py | 152 ------------------ netforce_clinic/models/schedule.py | 2 +- netforce_clinic/models/translate.py | 13 -- 9 files changed, 3 insertions(+), 185 deletions(-) delete mode 100644 netforce_clinic/actions/clinic_translate.xml delete mode 100644 netforce_clinic/layouts/clinic_translate_form.xml delete mode 100644 netforce_clinic/layouts/clinic_translate_list.xml delete mode 100644 netforce_clinic/models/report_hd_case_detail.py delete mode 100644 netforce_clinic/models/translate.py diff --git a/netforce_clinic/actions/clinic_schedule.xml b/netforce_clinic/actions/clinic_schedule.xml index 4e93a76..2b0b1b1 100644 --- a/netforce_clinic/actions/clinic_schedule.xml +++ b/netforce_clinic/actions/clinic_schedule.xml @@ -1,5 +1,5 @@ - Nurse Schedules + Schedules multi_view clinic.schedule calendar,list,page,form diff --git a/netforce_clinic/actions/clinic_translate.xml b/netforce_clinic/actions/clinic_translate.xml deleted file mode 100644 index 4c174f1..0000000 --- a/netforce_clinic/actions/clinic_translate.xml +++ /dev/null @@ -1,7 +0,0 @@ - - Translation - multi_view - clinic.translate - list,form - clinic_menu - diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 8a6dc40..dac844e 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -29,7 +29,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_translate_form.xml b/netforce_clinic/layouts/clinic_translate_form.xml deleted file mode 100644 index 1a87471..0000000 --- a/netforce_clinic/layouts/clinic_translate_form.xml +++ /dev/null @@ -1,4 +0,0 @@ -
- - - diff --git a/netforce_clinic/layouts/clinic_translate_list.xml b/netforce_clinic/layouts/clinic_translate_list.xml deleted file mode 100644 index 44ae2b1..0000000 --- a/netforce_clinic/layouts/clinic_translate_list.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index 07b3a18..28260d1 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -32,7 +32,6 @@ from . import cycle_item_line from . import gen_visit from . import gen_visit_line from . import report_clinic -from . import report_hd_case_detail from . import report_hd_case_summary from . import report_medical_summary from . import report_new_patient @@ -41,7 +40,6 @@ from . import fin_setting from . import import_data_mg from . import import_data_nhso from . import import_data_sc -from . import translate from . import payment from . import account_payment from . import account_invoice diff --git a/netforce_clinic/models/report_hd_case_detail.py b/netforce_clinic/models/report_hd_case_detail.py deleted file mode 100644 index 95146be..0000000 --- a/netforce_clinic/models/report_hd_case_detail.py +++ /dev/null @@ -1,152 +0,0 @@ -import time - -from netforce.model import Model, fields, get_model -from . import utils - -class ReportHDCaseDetail(Model): - _name="clinic.report.hd.case.detail" - _string="Hemodialysis Report Detail" - _transient=True - - _fields={ - "patient_id" : fields.Many2One("clinic.patient","Patient"), - "doctor_id" : fields.Many2One("clinic.personal","Doctor",domain=[['type','=','doctor']]), - "nurse_id" : fields.Many2One("clinic.personal","Nurse",domain=[['type','=','nurse']]), - "date_from": fields.Date("From"), - "date_to": fields.Date("To"), - "cycle_id": fields.Many2One("clinic.cycle","Cycle"), - "type": fields.Selection([("mg","Medical Goverment"),("sc","Social Security"),("nhso","NHSO (30B)"),("personal","Personal"),("other","Other")],"Type"), - - } - - _defaults={ - 'date_from': lambda *a: time.strftime("%Y-%m-%d"), - 'date_to': lambda *a: time.strftime("%Y-%m-%d"), - } - - _order="cycle_id desc" - - - def get_report_data(self,ids,context={}): - for item in get_model("company").search_browse([]): - company_name=item.name - - date_from=time.strftime("%Y-%m-%d") - date_to=time.strftime("%Y-%m-%d") - defaults=context.get("defaults") - if defaults: - if defaults.get("date_from"): - date_from=defaults['date_from'] - if defaults.get("date_to"): - date_to=defaults['date_to'] - - obj_doctor_id=None - dom=[] - dom.append(['state','=','completed']) - if ids: - obj=self.browse(ids)[0] - if obj.date_from: - date_from=obj.date_from - if obj.date_to: - date_to=obj.date_to - if obj.cycle_id: - dom.append([ - 'cycle_id','=',obj.cycle_id.id, - ]) - if obj.patient_id: - dom.append([ - 'patient_id','=',obj.patient_id.id, - ]) - if obj.doctor_id: - obj_doctor_id=obj.doctor_id - - dom.append(['time_start', ">=", date_from+" 00:00:00"]) - dom.append(['time_stop',"<=", date_to+" 23:59:59"]) - lines=[] - cycles=[] - index=0 - no_patient=0 - for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"): - dialyzer_number=hd_case.dlz_id.number or "" - dialyzer_id=hd_case.dlz_id.id or "" - patient_type=hd_case.patient_id.type - patient_type=utils.PATIENT_TYPE.get(patient_type) - cycle_name=hd_case.cycle_id.name or "" - total_fee=hd_case.fee_amount or 0.0 - doctors=[p for p in hd_case.personals if p.type=='doctor' and p.priop=='owner'] - doctor_id=None - if doctors: - doctor_id=doctors[0].personal_id - - # XXX - if obj_doctor_id: - if not obj_doctor_id.id==doctor_id.id: - continue - - show_cycle=False - if not cycle_name in cycles: - cycles.append(cycle_name) - show_cycle=True - vals={ - 'color': 'success', - 'show_cycle': False, - 'cycle' : "", - 'patient': "", - 'no_patient': no_patient, - 'patient_type' : "", - 'doctor' : "", - 'total' : "", - 'rc_no' : "", - 'dialyzer_name' : "", - 'nurse' : "", - } - lines.append(vals) - no_patient=1 - else: - no_patient+=1 - index+=1 - vals={ - 'show_cycle': show_cycle, - 'cycle' : cycle_name, - 'patient_id': hd_case.patient_id.id, - 'patient_name': hd_case.patient_id.name, - 'patient_type' : patient_type, - 'no_patient': 0, - 'doctor_id': doctor_id.id, - 'doctor_name' : doctor_id.name, - 'total' : total_fee, - 'hd_case_id' : hd_case.id, - 'rc_no' : hd_case.number, - 'dialyzer_number' : dialyzer_number, - 'dialyzer_id' : dialyzer_id, - } - lines.append(vals) - - # XXX - if lines: - vals={ - 'color': 'success', - 'show_cycle': False, - 'cycle' : "", - 'patient': "", - 'no_patient': no_patient, - 'patient_type' : "", - 'doctor' : "", - 'total' : "", - 'rc_no' : "", - 'dialyzer_name' : "", - 'nurse' : "", - } - lines.append(vals) - #XXX - del lines[0] - data={ - 'lines': lines, - 'same_date': date_from==date_to, - 'date_from': date_from, - 'date_to': date_to, - 'company_name': company_name, - } - return data - -ReportHDCaseDetail.register() diff --git a/netforce_clinic/models/schedule.py b/netforce_clinic/models/schedule.py index a195e60..17ef4c2 100644 --- a/netforce_clinic/models/schedule.py +++ b/netforce_clinic/models/schedule.py @@ -5,7 +5,7 @@ from netforce.access import get_active_company class Schedule(Model): _name="clinic.schedule" - _string="Nurse Schedule" + _string="Schedule" #_field_name="cycle_id" def _get_name(self,ids,context={}): diff --git a/netforce_clinic/models/translate.py b/netforce_clinic/models/translate.py deleted file mode 100644 index 716185c..0000000 --- a/netforce_clinic/models/translate.py +++ /dev/null @@ -1,13 +0,0 @@ -from netforce.model import Model, fields - -class Translate(Model): - _name="clinic.translate" - _string="Translate" - _field_name="org" - _fields={ - "org": fields.Char("Original String",required=True,search=True), - "tr": fields.Char("Translate"), - } - - -Translate.register()