From bc40c35d9f1704c3c480d0010231cba797bec873 Mon Sep 17 00:00:00 2001 From: Test server Date: Wed, 1 Oct 2014 17:52:21 +0700 Subject: [PATCH] clean --- netforce_clinic/actions/clinic_doctor.xml | 2 +- netforce_clinic/actions/clinic_nurse.xml | 2 +- netforce_clinic/actions/view_hdcase.xml | 5 ++ .../layouts/clinic_doctor_form.xml | 43 ++++--------- .../layouts/clinic_doctor_list.xml | 6 +- netforce_clinic/layouts/clinic_nurse_form.xml | 50 +++++---------- netforce_clinic/layouts/clinic_nurse_list.xml | 2 +- .../layouts/clinic_patient_form.xml | 63 +++++++------------ .../layouts/clinic_patient_list.xml | 7 +-- netforce_clinic/layouts/clinic_visit_form.xml | 2 +- netforce_clinic/layouts/clinic_visit_list.xml | 2 +- netforce_clinic/models/clinic_doctor.py | 41 +++++------- netforce_clinic/models/clinic_hd_case.py | 8 +++ netforce_clinic/models/clinic_nurse.py | 17 +++-- netforce_clinic/models/clinic_patient.py | 16 ++--- netforce_clinic/models/clinic_visit.py | 7 +-- 16 files changed, 105 insertions(+), 168 deletions(-) create mode 100644 netforce_clinic/actions/view_hdcase.xml diff --git a/netforce_clinic/actions/clinic_doctor.xml b/netforce_clinic/actions/clinic_doctor.xml index 9090912..5eb4df5 100644 --- a/netforce_clinic/actions/clinic_doctor.xml +++ b/netforce_clinic/actions/clinic_doctor.xml @@ -2,7 +2,7 @@ Doctors multi_view clinic.doctor - [["All",[]],["Draft",[["state","=","draft"]]],["Active",[["state","=","active"]]],["Deactive",[["state","=","deactive"]]]] + [["All",[]],["Temporaly",[["type","=","temporary"]]],["Permanent",[["type","=","permanent"]]]] list,page,form clinic_menu diff --git a/netforce_clinic/actions/clinic_nurse.xml b/netforce_clinic/actions/clinic_nurse.xml index 1f49d69..b117fe9 100644 --- a/netforce_clinic/actions/clinic_nurse.xml +++ b/netforce_clinic/actions/clinic_nurse.xml @@ -2,7 +2,7 @@ Nurses multi_view clinic.nurse - [["All",[]],["Draft",[["state","=","draft"]]],["Active",[["state","=","active"]]],["Deactive",[["state","=","deactive"]]]] + [["All",[]],["Temporaly",[["type","=","temporary"]]],["Permanent",[["type","=","permanent"]]]] list,page,form clinic_menu diff --git a/netforce_clinic/actions/view_hdcase.xml b/netforce_clinic/actions/view_hdcase.xml new file mode 100644 index 0000000..46799de --- /dev/null +++ b/netforce_clinic/actions/view_hdcase.xml @@ -0,0 +1,5 @@ + + method + clinic.hd.case + view_hdcase + diff --git a/netforce_clinic/layouts/clinic_doctor_form.xml b/netforce_clinic/layouts/clinic_doctor_form.xml index 6cd9765..69407c1 100644 --- a/netforce_clinic/layouts/clinic_doctor_form.xml +++ b/netforce_clinic/layouts/clinic_doctor_form.xml @@ -1,43 +1,26 @@
- + - - - - - - - - + - - - - - + + + + - - + - - - - - - - - - - - - - + + + + + diff --git a/netforce_clinic/layouts/clinic_doctor_list.xml b/netforce_clinic/layouts/clinic_doctor_list.xml index a6ea335..be1e6d2 100644 --- a/netforce_clinic/layouts/clinic_doctor_list.xml +++ b/netforce_clinic/layouts/clinic_doctor_list.xml @@ -1,7 +1,5 @@ - - - - + + diff --git a/netforce_clinic/layouts/clinic_nurse_form.xml b/netforce_clinic/layouts/clinic_nurse_form.xml index 8c5212b..6bb155d 100644 --- a/netforce_clinic/layouts/clinic_nurse_form.xml +++ b/netforce_clinic/layouts/clinic_nurse_form.xml @@ -1,42 +1,26 @@
- + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + diff --git a/netforce_clinic/layouts/clinic_nurse_list.xml b/netforce_clinic/layouts/clinic_nurse_list.xml index c341d8a..ad94d58 100644 --- a/netforce_clinic/layouts/clinic_nurse_list.xml +++ b/netforce_clinic/layouts/clinic_nurse_list.xml @@ -1,5 +1,5 @@ - + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index e3beb2f..bf3e582 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -7,40 +7,25 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + @@ -113,15 +98,9 @@ - - - - - - - - - - + + + + diff --git a/netforce_clinic/layouts/clinic_patient_list.xml b/netforce_clinic/layouts/clinic_patient_list.xml index 42dd284..752b2b2 100644 --- a/netforce_clinic/layouts/clinic_patient_list.xml +++ b/netforce_clinic/layouts/clinic_patient_list.xml @@ -1,7 +1,6 @@ - - - - + + + diff --git a/netforce_clinic/layouts/clinic_visit_form.xml b/netforce_clinic/layouts/clinic_visit_form.xml index 1618b08..f866b21 100644 --- a/netforce_clinic/layouts/clinic_visit_form.xml +++ b/netforce_clinic/layouts/clinic_visit_form.xml @@ -10,7 +10,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_visit_list.xml b/netforce_clinic/layouts/clinic_visit_list.xml index 428b979..ff291bc 100644 --- a/netforce_clinic/layouts/clinic_visit_list.xml +++ b/netforce_clinic/layouts/clinic_visit_list.xml @@ -1,6 +1,6 @@ - + diff --git a/netforce_clinic/models/clinic_doctor.py b/netforce_clinic/models/clinic_doctor.py index 29cee6c..abdca17 100644 --- a/netforce_clinic/models/clinic_doctor.py +++ b/netforce_clinic/models/clinic_doctor.py @@ -7,33 +7,29 @@ class Doctor(Model): _name="clinic.doctor" _string="Doctor" _audit_log=True - _name_field="name" _multi_company=True _fields={ "number": fields.Char("Doctor No.",required=True,search=True), - "first_name": fields.Char("First name",required=True,search=True), - "last_name" : fields.Char("Last name",required=False), - "date": fields.Date("Create Date",required=True,search=True), + "name": fields.Char("Name",required=True,search=True), "card_id" : fields.Char("Identity ID"), "card_expire" : fields.Date("Expire Date"), - "birthday": fields.Date("Date of birth",required=False,search=True), - "telephone": fields.Char("Telephone",required=False,search=True), - "department": fields.Selection([("temporary","Temporary"),("permanent","Permanent")], "Dapartment"), + "birthday": fields.Date("Date of Birth",search=True), + "telephone": fields.Char("Telephone",search=True), + "type": fields.Selection([("temporary","Temporary"),("permanent","Permanent")],"Type"), "mobile": fields.Char("Mobile",required=False,search=True), - #"licen" : fields.char("licens medicine No."), - "number2" : fields.Char("Certificate No."), - "licen_issued" : fields.Date("Issued on"), + "cert_no" : fields.Char("Certificate No."), + "cert_date" : fields.Date("Certificate Date"), "birthday": fields.Date("BirthDay",search=True), "telephone": fields.Char("Telephone",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True), "mobile": fields.Char("Mobile",search=True), "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status"), - "addresses" : fields.One2Many("address","related_id","Addresses"), - "comments" : fields.One2Many("message","related_id","Comments"), - "patients" : fields.Many2Many("clinic.patient","Patients"), - "visits" : fields.One2Many("clinic.visit","doctor_id","Visits"), - "hd_cases" : fields.One2Many("clinic.hd.case","doctor_id","HD Cases"), - "company_id" : fields.Many2One("company","Company"), + "addresses": fields.One2Many("address","related_id","Addresses"), + "comments": fields.One2Many("message","related_id","Comments"), + "patients": fields.Many2Many("clinic.patient","Patients"), + "visits": fields.One2Many("clinic.visit","nurse_id","Visits"), + "hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD cases"), + "company_id": fields.Many2One("company","Company"), } def _get_number(self,context={}): @@ -44,26 +40,21 @@ class Doctor(Model): res=self.search([["number","=",num]]) if not res: return num - get_model("sequence") .increment("sale_order") + get_model("sequence").increment("sale_order") _defaults={ - "state": "draft", + "type": "temporary", "date": lambda *a: time.strftime("%Y-%m-%d"), "number": _get_number, "company_id": lambda *a: get_active_company(), } _order="date desc,number desc" - def name_get(self,ids,context={}): - vals=[] - for obj in self.browse(ids): - name='%s %s'%(obj.first_name or "", obj.last_name or "") - vals.append((obj.id,name)) - return vals def void(self,ids,context={}): obj=self.browse(ids)[0] - obj.write({"state":"voided "}) + obj.write({"state":"voided"}) + Doctor.register() diff --git a/netforce_clinic/models/clinic_hd_case.py b/netforce_clinic/models/clinic_hd_case.py index d06de38..c1d78ab 100644 --- a/netforce_clinic/models/clinic_hd_case.py +++ b/netforce_clinic/models/clinic_hd_case.py @@ -205,4 +205,12 @@ class HDcase(Model): } return vals + def view_hdcase(self,ids,context={}): + return { + 'name': 'clinic_hd_case', + 'mode': 'form', + 'form_view_xml': 'clinic_hd_case_form', + 'active_id': ids[0], + } + HDcase.register() diff --git a/netforce_clinic/models/clinic_nurse.py b/netforce_clinic/models/clinic_nurse.py index 64c7a19..1d37e46 100644 --- a/netforce_clinic/models/clinic_nurse.py +++ b/netforce_clinic/models/clinic_nurse.py @@ -1,7 +1,6 @@ -from netforce.model import Model, fields, get_model -from netforce.utils import get_data_path import time -from netforce.access import get_active_user + +from netforce.model import Model, fields, get_model from netforce.access import get_active_company class Nurse(Model): @@ -12,17 +11,15 @@ class Nurse(Model): _multi_company=True _fields={ "number": fields.Char("Nurse No.",required=True,search=True), - "name": fields.Char("First name",required=True,search=True), - #"last_name" : fields.char("Last name"), - "lname" : fields.Char("Last name"), + "name": fields.Char("Name",required=True,search=True), "card_id" : fields.Char("Identity ID"), "card_expire" : fields.Date("Expire Date"), "birthday": fields.Date("Date of Birth",search=True), "telephone": fields.Char("Telephone",search=True), - "department": fields.Selection([("temporary","Temporary"),("permanent","Permanent")],"Department"), + "type": fields.Selection([("temporary","Temporary"),("permanent","Permanent")],"Type"), "mobile": fields.Char("Mobile",required=False,search=True), - "number2" : fields.Char("Certificate No."), - "licen_issued" : fields.Date("Issued on"), + "cert_no" : fields.Char("Certificate No."), + "cert_date" : fields.Date("Certificate Date"), "birthday": fields.Date("BirthDay",search=True), "telephone": fields.Char("Telephone",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True), @@ -48,7 +45,7 @@ class Nurse(Model): _defaults={ - "state": "draft", + "type": "temporary", "date": lambda *a: time.strftime("%Y-%m-%d"), "number": _get_number, "company_id": lambda *a: get_active_company(), diff --git a/netforce_clinic/models/clinic_patient.py b/netforce_clinic/models/clinic_patient.py index 036eefa..b1cf9e4 100644 --- a/netforce_clinic/models/clinic_patient.py +++ b/netforce_clinic/models/clinic_patient.py @@ -1,14 +1,12 @@ -from netforce.model import Model, fields, get_model -from netforce.utils import get_data_path import time -from netforce.access import get_active_user + +from netforce.model import Model, fields, get_model from netforce.access import get_active_company class Patient(Model): _name="clinic.patient" _string="Patient" _audit_log=True - _name_field="name" _multi_company=True def _get_age(self,ids,context): @@ -23,11 +21,9 @@ class Patient(Model): return res # -> {1: 30, 2: 45,.....} _fields={ - #Patient's Data "number": fields.Char("Patient ID",required=True,search=True), - "first_name": fields.Char("First Name",required=True,search=True), - "last_name": fields.Char("Last Name",required=False,search=True), - "date": fields.Date("Create Date",required=False,search=True), + "name": fields.Char("Name",required=True,search=True), + "reg_date": fields.Date("Reg.Date",required=False,search=True), "birthday": fields.Date("Date of birth",required=False,search=True), "telephone": fields.Char("Telephone",required=False,search=True), "mobile": fields.Char("Mobile",required=False,search=True), @@ -38,10 +34,10 @@ class Patient(Model): "height": fields.Integer("Height (Kg)"), "type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Type of treatment",required=False), "card_type": fields.Selection([("iden_id","Identity Card"),("passport","Passport")],"Card Type",required=True), - 'iden_id' : fields.Char("Card No."), + 'card_no' : fields.Char("Card No."), "app_no": fields.Char("Application No."), "salary": fields.Selection([["20000","5,001-20,000"],["50000","20,001-50,000"],["100000","50,001-100,000"],["100001","100,000+"]], "Salary"), - 'exp_id' : fields.Date("Expiry Date"), + 'exp_date' : fields.Date("Expiry Date"), "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status",required=False), "addresses": fields.One2Many("address","related_id","Addresses"), "gender": fields.Selection([("male","Male"),("female","Female")],"Gender",required=False), diff --git a/netforce_clinic/models/clinic_visit.py b/netforce_clinic/models/clinic_visit.py index 90b995e..c1f5b80 100644 --- a/netforce_clinic/models/clinic_visit.py +++ b/netforce_clinic/models/clinic_visit.py @@ -1,7 +1,4 @@ from netforce.model import Model, fields, get_model -from netforce.utils import get_data_path -import time -from netforce.access import get_active_user from netforce.access import get_active_company class Visit(Model): @@ -12,10 +9,10 @@ class Visit(Model): _multi_company=True _fields={ "number": fields.Char("Number",required=True,search=True), - "patient_id": fields.Many2One("clinic.patient","Patients",required=True,search=True), + "patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True), "doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True), "nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True), - "date": fields.Date("Visit Date",required=True,search=True), + "visit_date": fields.Date("Visit Date",required=True,search=True), "department": fields.Char("Department",required=False,search=True), "cycle": fields.Selection([("1","One"),("2","Two"),("3","Tree"),("4","Four")],"Cycle",required=True), "state": fields.Selection([("pending","Pending"),("confirmed","Confirmed"),("canceled","Canceled")],"Status",required=True),