From 605fdd2b8160d3105882c38ead7be05e7049c92f Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Wed, 6 May 2015 15:09:27 +0700 Subject: [PATCH] improve confirm visit --- .../layouts/clinic_visit_board_confirm.xml | 1 + netforce_clinic/models/visit_popup_confirm.py | 13 +++++++++++-- netforce_clinic/models/visit_popup_confirm_line.py | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/netforce_clinic/layouts/clinic_visit_board_confirm.xml b/netforce_clinic/layouts/clinic_visit_board_confirm.xml index 1057ec5..6b29578 100644 --- a/netforce_clinic/layouts/clinic_visit_board_confirm.xml +++ b/netforce_clinic/layouts/clinic_visit_board_confirm.xml @@ -4,6 +4,7 @@ + diff --git a/netforce_clinic/models/visit_popup_confirm.py b/netforce_clinic/models/visit_popup_confirm.py index de23ccd..f1ea43d 100644 --- a/netforce_clinic/models/visit_popup_confirm.py +++ b/netforce_clinic/models/visit_popup_confirm.py @@ -65,12 +65,16 @@ class VisitPopupConfirm(Model): cycle=visit.cycle_id patient=visit.patient_id department=visit.department_id - lines.append({ + doctor=visit.doctor_id + vals={ 'patient_id': patient.id, 'cycle_id': cycle.id, 'department_id': department.id, 'visit_id': visit.id, - }) + } + if doctor: + vals['doctor_id']=doctor.id + lines.append(vals) return lines _defaults={ @@ -85,6 +89,11 @@ class VisitPopupConfirm(Model): count=0 for line in obj.lines: vs=line.visit_id + dt=line.doctor_id + if dt: + vs.write({ + 'doctor_id': dt.id, + }) vs.confirm() count+=1 return { diff --git a/netforce_clinic/models/visit_popup_confirm_line.py b/netforce_clinic/models/visit_popup_confirm_line.py index d35001a..528a418 100644 --- a/netforce_clinic/models/visit_popup_confirm_line.py +++ b/netforce_clinic/models/visit_popup_confirm_line.py @@ -10,6 +10,7 @@ class VisitPopupConfirmLine(Model): 'department_id': fields.Many2One("clinic.department","Department"), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), 'visit_id': fields.Many2One("clinic.visit","Visit"), + 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]), } _defaults={