diff --git a/netforce_clinic/actions/clinic_personal.xml b/netforce_clinic/actions/clinic_personal.xml index 953b096..a8c385b 100644 --- a/netforce_clinic/actions/clinic_personal.xml +++ b/netforce_clinic/actions/clinic_personal.xml @@ -2,7 +2,7 @@ Personals multi_view clinic.personal - [["All",[]],["Archived",[["active","=",false]]],["Personal",[["type","=","personal"]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]] + [["All",[]],["Archived",[["active","=",false]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]] list,page,form clinic_menu diff --git a/netforce_clinic/layouts/clinic_personal_form.xml b/netforce_clinic/layouts/clinic_personal_form.xml index 57c1048..df06a20 100644 --- a/netforce_clinic/layouts/clinic_personal_form.xml +++ b/netforce_clinic/layouts/clinic_personal_form.xml @@ -35,10 +35,10 @@ - - + + - + @@ -58,8 +58,8 @@ - - + + diff --git a/netforce_clinic/layouts/clinic_schedule_form.xml b/netforce_clinic/layouts/clinic_schedule_form.xml index 94982f5..4ee6493 100644 --- a/netforce_clinic/layouts/clinic_schedule_form.xml +++ b/netforce_clinic/layouts/clinic_schedule_form.xml @@ -3,6 +3,7 @@ diff --git a/netforce_clinic/models/cycle_item.py b/netforce_clinic/models/cycle_item.py index 07a9729..976d762 100644 --- a/netforce_clinic/models/cycle_item.py +++ b/netforce_clinic/models/cycle_item.py @@ -37,6 +37,9 @@ class CycleItem(Model): } _order="sequence" + _sql_constraints=[ + ("cycle_item_uniq","unique (cycle_id,date,company_id)","Cycle item should be unique"), + ] def create(self, vals,**kw): date=vals['date'] diff --git a/netforce_clinic/models/schedule.py b/netforce_clinic/models/schedule.py index 17ef4c2..3243909 100644 --- a/netforce_clinic/models/schedule.py +++ b/netforce_clinic/models/schedule.py @@ -1,6 +1,6 @@ from datetime import datetime, timedelta -from netforce.model import Model, fields +from netforce.model import Model, fields, get_model from netforce.access import get_active_company class Schedule(Model): @@ -44,5 +44,34 @@ class Schedule(Model): 'state': 'draft', }) + + def view_cycle_item(self,ids,context={}): + obj=self.browse(ids)[0] + item_id=get_model("clinic.cycle.item").search([['cycle_id','=',obj.cycle_id.id],['date','=',obj.time_start[0:10]]]) + msg='' + if not item_id: + # XXX + item_id=get_model("clinic.cycle.item").create({ + 'cycle_id': obj.cycle_id.id, + 'date': obj.time_start[0:10], + }) + #raise Exception("No found cycle item") + item_nurse_obj=get_model("clinic.cycle.item.nurse") + for nurse in obj.nurses: + item_nurse_obj.create({ + 'cycle_item_id': item_id, + 'nurse_id': nurse.id, + 'level_id': nurse.level_id.id, + }) + msg='Create Cycle Item successfully' + return { + 'next': { + 'name': 'clinic_cycle_item', + 'mode': 'form', + 'active_id': item_id, + }, + 'flash': msg, + } + Schedule.register() diff --git a/netforce_clinic/templates/report_hd_case_summary.hbs b/netforce_clinic/templates/report_hd_case_summary.hbs index 333bd14..ad96124 100644 --- a/netforce_clinic/templates/report_hd_case_summary.hbs +++ b/netforce_clinic/templates/report_hd_case_summary.hbs @@ -64,8 +64,8 @@ หมายเหตุ - {{#if resign_patients}} - {{#each resign_patients}} + {{#if new_patients}} + {{#each new_patients}} {{no}} @@ -94,8 +94,8 @@ หมายเหตุ - {{#if new_patients}} - {{#each new_patients}} + {{#if resign_patients}} + {{#each resign_patients}} {{no}} diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index b8e66be..03a59d8 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,3 +1,7 @@ +====== + design visit + design cycle item + ====== flow: planing schedule