From 3e8f408ab8c3b2f60b22d96b4130aa25cb0d1fcf Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Tue, 13 Jan 2015 21:33:38 +0700 Subject: [PATCH] schedule --- .../actions/clinic_load_nurses.xml | 2 +- .../layouts/clinic_load_nurse_form.xml | 1 + netforce_clinic/layouts/clinic_menu.xml | 2 +- .../layouts/clinic_schedule_form.xml | 7 ++---- netforce_clinic/models/load_nurse.py | 23 +++++++++++++++++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/netforce_clinic/actions/clinic_load_nurses.xml b/netforce_clinic/actions/clinic_load_nurses.xml index 355d974..347cc23 100644 --- a/netforce_clinic/actions/clinic_load_nurses.xml +++ b/netforce_clinic/actions/clinic_load_nurses.xml @@ -1,5 +1,5 @@ - List Nurse + Nurses form_popup clinic.schedule.load.nurse _popup diff --git a/netforce_clinic/layouts/clinic_load_nurse_form.xml b/netforce_clinic/layouts/clinic_load_nurse_form.xml index dfdfd3e..99ff94f 100644 --- a/netforce_clinic/layouts/clinic_load_nurse_form.xml +++ b/netforce_clinic/layouts/clinic_load_nurse_form.xml @@ -1,6 +1,7 @@
+ diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 9ba13e5..3408af3 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -17,7 +17,7 @@
- + diff --git a/netforce_clinic/layouts/clinic_schedule_form.xml b/netforce_clinic/layouts/clinic_schedule_form.xml index 36a08c6..001708a 100644 --- a/netforce_clinic/layouts/clinic_schedule_form.xml +++ b/netforce_clinic/layouts/clinic_schedule_form.xml @@ -2,12 +2,9 @@ diff --git a/netforce_clinic/models/load_nurse.py b/netforce_clinic/models/load_nurse.py index 08e406a..47c712a 100644 --- a/netforce_clinic/models/load_nurse.py +++ b/netforce_clinic/models/load_nurse.py @@ -7,6 +7,7 @@ class LoadNurse(Model): _fields={ "schedule_id": fields.Many2One("clinic.schedule","Schedule",on_delete="cascade"), 'categ_id': fields.Many2One("clinic.staff.categ","Category", domain=[['type','=','nurse']]), + 'level_id': fields.Many2One("clinic.staff.level","Level", domain=[['type','=','nurse']]), "lines": fields.One2Many("clinic.schedule.load.nurse.line",'load_id', 'Lines'), } @@ -22,7 +23,7 @@ class LoadNurse(Model): if cycle_ids: cycle_id=cycle_ids[0] lines=[] - for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']]): + for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']], limit=5): in_cycle_id=None if nurse.cycle_id.id: in_cycle_id=nurse.cycle_id.id @@ -56,7 +57,7 @@ class LoadNurse(Model): lines.append({ 'cycle_id': cycle.id, 'nurse_id': nurse.id, - 'cycle_seq': cycle.sequence, + 'cycle_seq': cycle.sequence or 0, }) for line in schedule.lines: @@ -83,8 +84,26 @@ class LoadNurse(Model): def onchange_categ(self,context={}): data=context['data'] + data['lines']=[] + categ_id=data['categ_id'] + for nurse in get_model("clinic.staff").search([['type','=','nurse'],['categ_id','=',categ_id]]): + data['lines'].append(('create',{ + 'nurse_id': nurse.id} + )) + print('data ', data) return data + def onchange_level(self,context={}): + data=context['data'] + data['lines']=[] + level_id=data['level_id'] + for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']]): + if level_id==nurse.level_id.id: + data['lines'].append({ + 'nurse_id': nurse.id, + 'cycle_id': nurse.cycle_id.id, + }) + return data LoadNurse.register()