From 0af24d9bd12f481b75b93058495028b22b690b27 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Mon, 19 Jan 2015 12:34:50 +0700 Subject: [PATCH] add some filter --- netforce_clinic/layouts/clinic_board.xml | 2 +- netforce_clinic/layouts/clinic_make_apt.xml | 11 +++++++---- netforce_clinic/layouts/clinic_visit_board.xml | 8 +------- netforce_clinic/layouts/clinic_visit_widget.xml | 2 ++ netforce_clinic/models/make_apt.py | 14 +++++++++++++- netforce_clinic/models/visit_board.py | 7 ++++++- 6 files changed, 30 insertions(+), 14 deletions(-) diff --git a/netforce_clinic/layouts/clinic_board.xml b/netforce_clinic/layouts/clinic_board.xml index 48b30f0..d497e41 100644 --- a/netforce_clinic/layouts/clinic_board.xml +++ b/netforce_clinic/layouts/clinic_board.xml @@ -1,6 +1,6 @@ - + diff --git a/netforce_clinic/layouts/clinic_make_apt.xml b/netforce_clinic/layouts/clinic_make_apt.xml index 6ff2be3..7515862 100644 --- a/netforce_clinic/layouts/clinic_make_apt.xml +++ b/netforce_clinic/layouts/clinic_make_apt.xml @@ -1,8 +1,11 @@
- - - - + + + + + + + diff --git a/netforce_clinic/layouts/clinic_visit_board.xml b/netforce_clinic/layouts/clinic_visit_board.xml index aed18d6..bd1c360 100644 --- a/netforce_clinic/layouts/clinic_visit_board.xml +++ b/netforce_clinic/layouts/clinic_visit_board.xml @@ -6,11 +6,5 @@ - - - - - - - + diff --git a/netforce_clinic/layouts/clinic_visit_widget.xml b/netforce_clinic/layouts/clinic_visit_widget.xml index 5c83e75..670300d 100644 --- a/netforce_clinic/layouts/clinic_visit_widget.xml +++ b/netforce_clinic/layouts/clinic_visit_widget.xml @@ -4,6 +4,8 @@ + + diff --git a/netforce_clinic/models/make_apt.py b/netforce_clinic/models/make_apt.py index 7581360..2a5dfe4 100644 --- a/netforce_clinic/models/make_apt.py +++ b/netforce_clinic/models/make_apt.py @@ -17,6 +17,9 @@ class MakeAPT(Model): "date": fields.Date("Month"), "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), + 'department_id': fields.Many2One("clinic.department","Department"), + 'branch_id': fields.Many2One("clinic.branch","Branch"), + 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), "lines": fields.One2Many("clinic.make.apt.line","apt_id","Lines"), } @@ -38,7 +41,16 @@ class MakeAPT(Model): def load(self,ids,context={}): obj=self.browse(ids)[0] pts={} - for pc in get_model("clinic.patient.cycle").search_browse([]): + dom=[] + if obj.department_id: + dom.append(['department_id','=',obj.department_id.id]) + if obj.cycle_id: + dom.append(['cycle_id','=',obj.cycle_id.id]) + branch_id=obj.branch_id.id + for pc in get_model("clinic.patient.cycle").search_browse(dom): + branch=pc.department_id.branch_id + if branch_id and branch_id!=branch.id: + continue patient=pc.patient_id dpt=pc.department_id key=(patient.id,dpt.id) diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index 83b6122..355c7f7 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -31,8 +31,9 @@ class VisitBoard(Model): "date_to": fields.Date("To", required=True), 'patient_id': fields.Many2One("clinic.patient","Patient"), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), - 'department_id': fields.Many2One("clinic.department","Department"), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[["type","=","doctor"]]), + 'department_id': fields.Many2One("clinic.department","Department"), + 'branch_id': fields.Many2One("clinic.branch","Branch"), } _defaults={ @@ -51,6 +52,7 @@ class VisitBoard(Model): cycle_id=None doctor_id=None department_id=None + branch_id=None if ids: obj=self.browse(ids)[0] date_from=obj.date_from @@ -59,6 +61,7 @@ class VisitBoard(Model): cycle_id=obj.cycle_id.id doctor_id=obj.doctor_id.id department_id=obj.department_id.id + branch_id=obj.branch_id.id time_start='%s 00:00:00'%(date_from) time_stop='%s 23:59:59'%(date_to) @@ -74,6 +77,8 @@ class VisitBoard(Model): dom.append(['doctor_id','=',doctor_id]) if department_id: dom.append(['department_id','=',department_id]) + if branch_id: + dom.append(['branch_id','=',branch_id]) lines=[] empty_line={