From b9ba5c9f17b9d374111ac9929ba4200ddc77c453 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Mon, 2 Mar 2015 11:03:07 +0700 Subject: [PATCH] improvement --- netforce_clinic/actions/clinic_patient.xml | 7 ++++- .../layouts/clinic_patient_form.xml | 14 ++++----- .../layouts/clinic_patient_list.xml | 3 +- .../clinic_report_labor_cost_summary.xml | 2 +- netforce_clinic/models/address.py | 2 +- netforce_clinic/models/dialyzer.py | 2 +- netforce_clinic/models/hd_case.py | 5 ++-- netforce_clinic/models/hd_case_expense.py | 2 +- netforce_clinic/models/hd_case_staff.py | 2 +- netforce_clinic/models/import_payment_line.py | 2 +- netforce_clinic/models/make_apt.py | 5 +++- netforce_clinic/models/make_apt_line.py | 2 +- netforce_clinic/models/patient.py | 24 +++++++++++++-- netforce_clinic/models/patient_cause.py | 2 +- netforce_clinic/models/patient_comorbidity.py | 4 +-- netforce_clinic/models/patient_cycle.py | 2 +- netforce_clinic/models/patient_morbidity.py | 2 +- .../models/report_hd_case_detail.py | 2 +- .../models/report_labor_cost_summary.py | 4 +-- .../models/report_payment_matching.py | 2 +- netforce_clinic/models/report_staff_line.py | 2 +- .../models/report_staff_patient.py | 2 +- netforce_clinic/models/report_visit.py | 2 +- netforce_clinic/models/setting.py | 6 ++++ netforce_clinic/models/shop.py | 2 +- netforce_clinic/models/sickbed.py | 2 +- netforce_clinic/models/staff.py | 21 +++---------- netforce_clinic/models/visit.py | 2 +- netforce_clinic/models/visit_board.py | 2 +- .../models/visit_popup_confirm_line.py | 2 +- netforce_clinic/todo.txt | 30 ++----------------- 31 files changed, 75 insertions(+), 88 deletions(-) diff --git a/netforce_clinic/actions/clinic_patient.xml b/netforce_clinic/actions/clinic_patient.xml index d29a5b1..d943930 100644 --- a/netforce_clinic/actions/clinic_patient.xml +++ b/netforce_clinic/actions/clinic_patient.xml @@ -2,7 +2,12 @@ Patients multi_view clinic.patient - [["All",[]],["Archived",[["active","=","False"]]]] + [ + ["All",[]], + ["Archived",[["active","=","False"]]], + ["Admit",[["state","=","admit"]]], + ["Dispose",[["state","=","dispose"]]]] + clinic_menu 25 diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 576a7ee..9427e32 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -20,7 +20,7 @@ - + @@ -77,14 +77,10 @@ - - - - - - - - + + + + diff --git a/netforce_clinic/layouts/clinic_patient_list.xml b/netforce_clinic/layouts/clinic_patient_list.xml index 7c5730a..7dcf870 100644 --- a/netforce_clinic/layouts/clinic_patient_list.xml +++ b/netforce_clinic/layouts/clinic_patient_list.xml @@ -1,4 +1,4 @@ - + diff --git a/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml b/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml index 70f16a2..64c89e2 100644 --- a/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml +++ b/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml @@ -3,7 +3,7 @@ - + diff --git a/netforce_clinic/models/address.py b/netforce_clinic/models/address.py index 7ba6a76..1d3b3da 100644 --- a/netforce_clinic/models/address.py +++ b/netforce_clinic/models/address.py @@ -5,7 +5,7 @@ class Address(Model): _inherit="address" _fields={ - "patient_id": fields.Many2One("clinic.patient","Patient"), + "patient_id": fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), "staff_id": fields.Many2One("clinic.staff","Staff"), } diff --git a/netforce_clinic/models/dialyzer.py b/netforce_clinic/models/dialyzer.py index 16f8a58..4474f27 100644 --- a/netforce_clinic/models/dialyzer.py +++ b/netforce_clinic/models/dialyzer.py @@ -25,7 +25,7 @@ class Dialyzer(Model): "company_id": fields.Many2One("company","Company"), 'product_id': fields.Many2One("product", "Product",required=True,search=True), "pickings": fields.One2Many("stock.picking","related_id","Pickings"), - "patient_id": fields.Many2One("clinic.patient","Patient",search=True), + "patient_id": fields.Many2One("clinic.patient","Patient",search=True,domain=[['state','=','admit']]), "visit_id": fields.Many2One("clinic.visit","Visit",search=True), "hd_case_id": fields.Many2One("clinic.hd.case","HD Case",search=True), "hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 9100660..a8533a7 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -96,7 +96,7 @@ class HDCase(Model): "time_start": fields.DateTime("Start Time",required=True), "time_stop": fields.DateTime("Finish Time",required=True), "date": fields.Date("Date",required=True,search=True), - "patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True), + "patient_id": fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']],required=True,search=True), "patient_type_id": fields.Many2One("clinic.patient.type", "Type"), "nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]), "department_id": fields.Many2One("clinic.department", "Department",search=True), @@ -753,6 +753,7 @@ class HDCase(Model): return True def do_expense(self,ids,context={}): + # not longer use 2015-02-28 for obj in self.browse(ids): # clear old expense for exp in obj.expenes: @@ -794,7 +795,7 @@ class HDCase(Model): obj.make_invoices(context=context) obj.post_invoices(context=context) obj.create_cycle_item() - obj.do_expense(context=context) + #obj.do_expense(context=context) vals={ "state":"waiting_payment", # for government } diff --git a/netforce_clinic/models/hd_case_expense.py b/netforce_clinic/models/hd_case_expense.py index 60eabce..5bd5c9c 100644 --- a/netforce_clinic/models/hd_case_expense.py +++ b/netforce_clinic/models/hd_case_expense.py @@ -30,7 +30,7 @@ class HDCaseExpense(Model): _fields={ 'name': fields.Char("Name", function="_get_store",store=True), 'date': fields.Date("Date",required=True,search=True), - 'patient_id': fields.Many2One("clinic.patient","Patient",required=True,search=True), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']], required=True,search=True), 'hd_case_id': fields.Many2One("clinic.hd.case","HD Case",required=True,search=True), 'payment_id': fields.Many2One("account.payment","Payment",search=True), "invoices": fields.One2Many("account.invoice","clinic_expense_id","Invoices"), diff --git a/netforce_clinic/models/hd_case_staff.py b/netforce_clinic/models/hd_case_staff.py index d345989..8bb24ca 100644 --- a/netforce_clinic/models/hd_case_staff.py +++ b/netforce_clinic/models/hd_case_staff.py @@ -27,7 +27,7 @@ class HDCaseStaff(Model): "priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"), 'note': fields.Char("Note"), 'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True), - 'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']], function="_get_all",function_multi=True), 'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True), 'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True), 'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True), diff --git a/netforce_clinic/models/import_payment_line.py b/netforce_clinic/models/import_payment_line.py index 4a0862c..a1beee6 100644 --- a/netforce_clinic/models/import_payment_line.py +++ b/netforce_clinic/models/import_payment_line.py @@ -9,7 +9,7 @@ class PaymentLine(Model): 'date': fields.Date("Date"), 'ref': fields.Char("Ref"), 'invoice_id': fields.Many2One("account.invoice","Invoice"), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'hd_case_id': fields.Many2One("clinic.hd.case","HDCase"), 'state': fields.Selection([['match','Match'],['unmatch','Unmatch']],"State"), 'amount': fields.Float("Amount"), diff --git a/netforce_clinic/models/make_apt.py b/netforce_clinic/models/make_apt.py index 4c83ed6..1d1e88a 100644 --- a/netforce_clinic/models/make_apt.py +++ b/netforce_clinic/models/make_apt.py @@ -42,6 +42,7 @@ class MakeAPT(Model): obj=self.browse(ids)[0] pts={} dom=[] + dom.append(['patient_id.state','=','admit']) if obj.department_id: dom.append(['department_id','=',obj.department_id.id]) if obj.cycle_id: @@ -76,6 +77,8 @@ class MakeAPT(Model): patient=pc.patient_id dpt=pc.department_id branch=dpt.branch_id + if not branch: + continue if branch_id and branch_id!=branch.id: continue key=(patient.id,dpt.id) @@ -131,7 +134,7 @@ class MakeAPT(Model): 'mode': 'form', 'active_id': obj.id, }, - 'flash': 'Ready to generate', + #'flash': 'Ready to generate', #remove this message because user confuse } def gen(self,ids,context={}): diff --git a/netforce_clinic/models/make_apt_line.py b/netforce_clinic/models/make_apt_line.py index 6f4c034..3ecf537 100644 --- a/netforce_clinic/models/make_apt_line.py +++ b/netforce_clinic/models/make_apt_line.py @@ -6,7 +6,7 @@ class MakeAPTLine(Model): _fields={ 'apt_id': fields.Many2One("clinic.make.apt","APT", required=True,on_delete="cascade"), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'mon_cycle_id': fields.Many2One("clinic.cycle","Monday"), 'tue_cycle_id': fields.Many2One("clinic.cycle","Tuesday"), 'wed_cycle_id': fields.Many2One("clinic.cycle","Wednesday"), diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index c885cdf..365ef12 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -118,7 +118,7 @@ class Patient(Model): "hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"), "partner_id": fields.Many2One("partner","Contact"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), - "active":fields.Boolean("Uncheck as discountinue", search=True), + "active":fields.Boolean("Active", search=True), 'note': fields.Text("Note"), 'categ_id': fields.Many2One("clinic.patient.categ","Category"), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]), @@ -130,6 +130,7 @@ class Patient(Model): 'branch_id': fields.Many2One("clinic.branch","Branch",search=True), 'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"), "vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."), + 'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'), } def _get_number(self,context={}): @@ -176,12 +177,24 @@ class Patient(Model): 'card_type': 'identification', 'type_id': _get_type, "active" : True, + 'state': 'admit', } _sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), - _order="resign_date desc,number desc" + _order="number desc" + + def check_idcard(self,idcard=''): + res=True + if idcard.isalpha(): + res=False + elif len(idcard)!=13: + res=False + if not res: + raise Exception("Wrong ID Card!") def create(self, vals,**kw): + if 'card_no' in vals.keys(): + self.check_idcard(vals['card_no']) obj_id=super().create(vals,**kw) self.function_store([obj_id]) obj=self.browse(obj_id) @@ -229,7 +242,8 @@ class Patient(Model): super().delete(ids) def write(self,ids,vals,**kw): - #TODO change department of patient after change department + if 'card_no' in vals.keys(): + self.check_idcard(vals['card_no']) ctx={} if 'active' in vals.keys(): if not vals['active']: @@ -243,6 +257,9 @@ class Patient(Model): for visit in get_model('clinic.visit').browse(vids): visit.write(visit_vals) for obj in self.browse(ids): + if obj.state=='treatment': + vals['note']='' + vals['resign_date']=None visit_vals={} if 'department_id' in vals.keys(): visit_vals.update({ @@ -375,5 +392,6 @@ class Patient(Model): 'active_id': obj.id, },'flash': 'New Dialyzer successfully', } + Patient.register() diff --git a/netforce_clinic/models/patient_cause.py b/netforce_clinic/models/patient_cause.py index 76bd481..7e9a69a 100644 --- a/netforce_clinic/models/patient_cause.py +++ b/netforce_clinic/models/patient_cause.py @@ -6,7 +6,7 @@ class PatientCause(Model): _name="clinic.patient.cause" _string="Patient Cause" _fields={ - "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), + "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade",domain=[['state','=','admit']]), "cause_id": fields.Many2One("clinic.cause.chronic","Cause"), "date_cause": fields.Date("Date Cause"), } diff --git a/netforce_clinic/models/patient_comorbidity.py b/netforce_clinic/models/patient_comorbidity.py index b77486e..9419b19 100644 --- a/netforce_clinic/models/patient_comorbidity.py +++ b/netforce_clinic/models/patient_comorbidity.py @@ -1,12 +1,10 @@ -import time - from netforce.model import Model, fields class PatientComorbidity(Model): _name="clinic.patient.comorbidity" _string="Patient Patient Comorbidity" _fields={ - "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), + "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade",domain=[['state','=','admit']]), "comorbility_id": fields.Many2One("clinic.comorbidity","Comorbidity"), "ans": fields.Selection([['yes','Yes'],['no','No']], "Answer"), "analysis_date": fields.Date("Analysis Date"), diff --git a/netforce_clinic/models/patient_cycle.py b/netforce_clinic/models/patient_cycle.py index fdded01..21cf13e 100644 --- a/netforce_clinic/models/patient_cycle.py +++ b/netforce_clinic/models/patient_cycle.py @@ -5,7 +5,7 @@ class PatientCycle(Model): _string="Patient Cycle" _fields={ - "patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True), + "patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True,domain=[['state','=','admit']]), "cycle_id": fields.Many2One('clinic.cycle',"Cycle",search=True), "department_id": fields.Many2One('clinic.department',"Department",search=True), 'day': fields.Selection([('mon', 'Monday'), ('tue','Tuesday'), ('wed','Wednesday'),('thu','Thursday'),('fri','Friday'),('sat','Saturday'),('sun','Sunday')], 'Day',search=True), diff --git a/netforce_clinic/models/patient_morbidity.py b/netforce_clinic/models/patient_morbidity.py index 9417574..b4524c0 100644 --- a/netforce_clinic/models/patient_morbidity.py +++ b/netforce_clinic/models/patient_morbidity.py @@ -4,7 +4,7 @@ class PatientMorbidity(Model): _name="clinic.patient.morbidity" _string="Patient Patient Morbidity" _fields={ - "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), + "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade",domain=[['state','=','admit']]), "morbility_id": fields.Many2One("clinic.morbidity","Morbidity"), "ans": fields.Selection([['yes','Yes'],['no','No']], "Answer"), "analysis_date": fields.Date("Analysis Date"), diff --git a/netforce_clinic/models/report_hd_case_detail.py b/netforce_clinic/models/report_hd_case_detail.py index 9985e3a..3e49fc5 100644 --- a/netforce_clinic/models/report_hd_case_detail.py +++ b/netforce_clinic/models/report_hd_case_detail.py @@ -15,7 +15,7 @@ class ReportHDCaseDetail(Model): "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), 'patient_type_id': fields.Many2One("clinic.patient.type","Payers"), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'branch_id': fields.Many2One("clinic.branch","Branch"), 'department_id': fields.Many2One("clinic.department","Department"), } diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py index aa50bdb..5b8552e 100644 --- a/netforce_clinic/models/report_labor_cost_summary.py +++ b/netforce_clinic/models/report_labor_cost_summary.py @@ -68,7 +68,6 @@ class ReportLaborCostSummary(Model): only_value=obj.only_value dom.append(['date','>=',date_from]) dom.append(['date','<=',date_to]) - print("staff_type ", staff_type) if staff_id: dom.append(['staff_id','=',staff_id]) if staff_type: @@ -88,7 +87,6 @@ class ReportLaborCostSummary(Model): categ_id=None categ=staff.categ_id level_name='' - #XXX fix if not staff: continue if level_id and staff.level_id.id!=level_id: @@ -180,7 +178,7 @@ class ReportLaborCostSummary(Model): 'dpts': dpts, 'comp_name': comp.name or 0, 'comp_span': len(dpts), - 'lines': lines, + 'lines': sorted(lines, key=lambda x: x['number']), 'total_lines': total_lines, } return data diff --git a/netforce_clinic/models/report_payment_matching.py b/netforce_clinic/models/report_payment_matching.py index f03a6cc..21eb0ba 100644 --- a/netforce_clinic/models/report_payment_matching.py +++ b/netforce_clinic/models/report_payment_matching.py @@ -24,7 +24,7 @@ class ReportPaymentMatching(Model): "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), 'state': fields.Selection([['draft','Draft'],['waiting_matching','Waiting Matching'],['match','Match'],['unmatch','Unmatch'],['approved','Approved']],'State'), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'file': fields.File("File"), 'type_id': fields.Many2One("clinic.patient.type","Patient Type",required=True), 'hcode_id': fields.Many2One("clinic.hospital","HCode",required=True), diff --git a/netforce_clinic/models/report_staff_line.py b/netforce_clinic/models/report_staff_line.py index 6ec6bc2..98eb12c 100644 --- a/netforce_clinic/models/report_staff_line.py +++ b/netforce_clinic/models/report_staff_line.py @@ -17,7 +17,7 @@ class ReportStaffLine(Model): 'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"), 'hd_case_id': fields.Many2One("clinic.hd.case","HD Case"), 'date': fields.Date("Date",function="_get_all", function_multi=True), - 'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True), + 'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True,domain=[['state','=','admit']]), 'amount': fields.Float("Amount"), } diff --git a/netforce_clinic/models/report_staff_patient.py b/netforce_clinic/models/report_staff_patient.py index ed782ac..2bac23c 100644 --- a/netforce_clinic/models/report_staff_patient.py +++ b/netforce_clinic/models/report_staff_patient.py @@ -6,7 +6,7 @@ class ReportStaffPatient(Model): _fields={ 'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'date': fields.Date("Date"), 'amount': fields.Float("Amount"), } diff --git a/netforce_clinic/models/report_visit.py b/netforce_clinic/models/report_visit.py index 08c82a4..43122f9 100644 --- a/netforce_clinic/models/report_visit.py +++ b/netforce_clinic/models/report_visit.py @@ -15,7 +15,7 @@ class ReportVisit(Model): "date": fields.Date("Month"), "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), - "patient_id": fields.Many2One("clinic.patient","Patient"), + "patient_id": fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), "doctor_id": fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]), "state": fields.Selection([["draft","Draft"],['pending','Pending'],["confirmed","Confirmed"],["cancelled","Cancelled"]],"Status",required=True), } diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 894d1f9..edec093 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -110,6 +110,12 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return + for pt in get_model("clinic.patient").search_browse([]): + pt.write({ + 'state': 'admit', + }) + print("Done!") + return for citem in get_model("clinic.cycle.item").search_browse([]): for line in citem.lines: nurse=line.nurse_id diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 1fd5f27..6907e25 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -30,7 +30,7 @@ class Shop(Model): "number": fields.Char("Number",required=True,search=True), "ref": fields.Char("Ref",search=True), 'date': fields.Date("Date",search=True), - 'patient_id': fields.Many2One('clinic.patient','Patient',search=True), + 'patient_id': fields.Many2One('clinic.patient','Patient',search=True,domain=[['state','=','admit']]), 'contact_id': fields.Many2One('partner','Contact',search=True), 'department_id': fields.Many2One("clinic.department","Department",search=True), 'branch_id': fields.Many2One("clinic.branch","Branch",search=True), diff --git a/netforce_clinic/models/sickbed.py b/netforce_clinic/models/sickbed.py index 3a86542..02fe9fe 100644 --- a/netforce_clinic/models/sickbed.py +++ b/netforce_clinic/models/sickbed.py @@ -30,7 +30,7 @@ class SickBed(Model): "available": fields.Boolean("Available"), 'hd_cases': fields.One2Many("clinic.hd.case",'sickbed_id','HDCases'), 'company_id': fields.Many2One("company","Company"), - 'patient_id': fields.Many2One("clinic.patient","Lasted Patient",function="_get_all",function_multi=True), + 'patient_id': fields.Many2One("clinic.patient","Lasted Patient",function="_get_all",function_multi=True,domain=[['state','=','admit']]), 'image': fields.File("Image",function="_get_all",function_multi=True), 'date': fields.Date("Lasted Date",function="_get_all",function_multi=True), "state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"), diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py index 7e90c05..e3701b3 100644 --- a/netforce_clinic/models/staff.py +++ b/netforce_clinic/models/staff.py @@ -295,13 +295,10 @@ class Staff(Model): def name_get(self,ids,context={}): vals=[] for obj in self.browse(ids): - level=obj.level_id name=obj.name or "" nickname=obj.nick_name or "" - if level: - if nickname: - name+=" (%s)"%(nickname) - name+=" - %s"%(level.name or "") + if nickname: + name+=" (%s)"%(nickname) vals.append((obj.id,name)) return vals @@ -310,21 +307,11 @@ class Staff(Model): if domain: dom=[dom,domain] ids1=self.search(dom) - - dom=[["name","ilike","%"+name+"%"]] - level_ids=get_model('clinic.staff.level').search(dom) - ids2=[] - for x in self.search_read([domain],['level_id']): - if x['level_id']: - level_id=x['level_id'][0] - if level_id in level_ids: - ids2.append(x['id']) dom=[["nick_name","ilike","%"+name+"%"]] if domain: dom=[dom,domain] - ids3=self.search(dom) - - ids=list(set(ids1+ids2+ids3)) + ids2=self.search(dom) + ids=list(set(ids1+ids2)) return self.name_get(ids,context=context) Staff.register() diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py index d61c2f5..0ee3aa1 100644 --- a/netforce_clinic/models/visit.py +++ b/netforce_clinic/models/visit.py @@ -34,7 +34,7 @@ class Visit(Model): "number": fields.Char("Number",required=True,search=True), "time_start": fields.DateTime("Start Time",required=True), "time_stop": fields.DateTime("End Time",required=True), - "patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True), + "patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True,domain=[['state','=','admit']]), "doctor_id": fields.Many2One("clinic.staff","Doctor", domain=[['type','=','doctor']],search=True), "nurse_id": fields.Many2One("clinic.staff","Confirm By", domain=[['type','=','nurse']],search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True), diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index 527dd4d..9d45688 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -30,7 +30,7 @@ class VisitBoard(Model): "date": fields.Date("Month", required=False), "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[["type","=","doctor"]]), 'department_id': fields.Many2One("clinic.department","Department"), diff --git a/netforce_clinic/models/visit_popup_confirm_line.py b/netforce_clinic/models/visit_popup_confirm_line.py index 4bde394..d35001a 100644 --- a/netforce_clinic/models/visit_popup_confirm_line.py +++ b/netforce_clinic/models/visit_popup_confirm_line.py @@ -6,7 +6,7 @@ class VisitPopupConfirmLine(Model): _fields={ "popup_visit_id": fields.Many2One("clinic.popup.visit.confirm","Popup Board",required=True,on_delete="cascade"), - 'patient_id': fields.Many2One("clinic.patient","Patient"), + 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]), 'department_id': fields.Many2One("clinic.department","Department"), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), 'visit_id': fields.Many2One("clinic.visit","Visit"), diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index a72ee88..efd8f97 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,4 +1,6 @@ todo: + - set patient_id with domain state=='treatment' + - compute labor cost - update level @@ -15,33 +17,5 @@ todo: create contact from staff -> ok script to clear invoice -> ok -requirement: - -1.1 Profile STAFF ยังไม่สามารถ กำหนดให้ 1คน มี profile ได้หลาย Department (ตามเมล์ date: Mon, Feb 23, 2015 at 3:15 PM ที่คุณพอลลี่แจ้งมา อยู่ระหว่างกำลังแก้ไข) - -1.2 HD Cases ยังพบ bug ในส่วน Expense EPO ที่เบิกได้ตามสิทธิ์ของผู้ป่วย เลือก Product แล้วราคาไม่แสดง - -> config on product price list and retest it again - -1.3 HD Cases ในส่วน Expense ที่ถูกต้อง เมื่อเลือก Product แล้ว Product นั้นต้องสัมพันธ์กับสถานะ Reimbursable (เช่น Category: EPO Product: [61006-SSO] EPIAO-SSO Reimbursable ต้องเป็น Yes ถ้า EPO ขาย สถานะ Reimbursable เป็น No) - ->ok - -1.4 RC เป็น PDF + ชื่อพยาบาล วันที่ (ตรงลายเซ็นคุณผดา ต้องการให้สามารถใส่ไฟล์แก้ไขได้เอง) - -1.5 HD Case Summary สร้าง filter กรองตามชั้น - -> ok - - - -2. Accounting issues - -2.1 HD Cases Matching - -2.2 Statement Matching - -2.3 ค่าตอบแทนแพทย์ และพยาบาล (ตามที่ คุณบอย แจ้งเมื่อวันที่ 19 ก.พ. 58) - -2.4 Bank Reconciliation - -2.5 Fixed Asset