diff --git a/netforce_clinic/layouts/clinic_hd_case_list.xml b/netforce_clinic/layouts/clinic_hd_case_list.xml index 12d55d9..3ed88ef 100644 --- a/netforce_clinic/layouts/clinic_hd_case_list.xml +++ b/netforce_clinic/layouts/clinic_hd_case_list.xml @@ -1,10 +1,10 @@ + - diff --git a/netforce_clinic/layouts/clinic_schedule_form.xml b/netforce_clinic/layouts/clinic_schedule_form.xml index eadf7db..ecd67f2 100644 --- a/netforce_clinic/layouts/clinic_schedule_form.xml +++ b/netforce_clinic/layouts/clinic_schedule_form.xml @@ -12,6 +12,8 @@ + + @@ -22,7 +24,6 @@ - diff --git a/netforce_clinic/layouts/clinic_schedule_list.xml b/netforce_clinic/layouts/clinic_schedule_list.xml index 34cb5de..f46106f 100644 --- a/netforce_clinic/layouts/clinic_schedule_list.xml +++ b/netforce_clinic/layouts/clinic_schedule_list.xml @@ -1,5 +1,7 @@ + + diff --git a/netforce_clinic/layouts/clinic_staff_form.xml b/netforce_clinic/layouts/clinic_staff_form.xml index f38ae19..4e663f7 100644 --- a/netforce_clinic/layouts/clinic_staff_form.xml +++ b/netforce_clinic/layouts/clinic_staff_form.xml @@ -11,7 +11,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_visit_search.xml b/netforce_clinic/layouts/clinic_visit_search.xml index e2c25e4..0f28c42 100644 --- a/netforce_clinic/layouts/clinic_visit_search.xml +++ b/netforce_clinic/layouts/clinic_visit_search.xml @@ -1,7 +1,9 @@ + - + + diff --git a/netforce_clinic/models/cycle_item.py b/netforce_clinic/models/cycle_item.py index d27e2b0..c988178 100644 --- a/netforce_clinic/models/cycle_item.py +++ b/netforce_clinic/models/cycle_item.py @@ -20,7 +20,7 @@ class CycleItem(Model): name="%s-%s"%(cycle_name,obj.date) res[obj.id]={ 'name': name, - 'sequence':'%s-%s'%(obj.date,cycle.sequence), + 'sequence':'%s-%s-%s-%s'%(obj.date,cycle.sequence,obj.branch_id.id,obj.department_id.id), } return res diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 66f43fc..5e19928 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -632,6 +632,7 @@ class HDCase(Model): datenow=time.strftime('%Y-%m-%d') cycle_id=obj.cycle_id.id branch_id=obj.branch_id.id + department_id=obj.department_id.id dom=[] if datenow: dom.append(['date','=',datenow]) @@ -639,6 +640,8 @@ class HDCase(Model): dom.append(['cycle_id','=',cycle_id]) if branch_id: dom.append(['branch_id','=',branch_id]) + if department_id: + dom.append(['department_id','=',department_id]) cycle_item_ids=cycle_item.search(dom) cycle_item_id=None if cycle_item_ids: @@ -646,7 +649,9 @@ class HDCase(Model): else: cycle_item_id=cycle_item.create({ 'date': obj.date, - 'cycle_id': obj.cycle_id.id, + 'cycle_id': cycle_id, + 'branch_id': branch_id, + 'department_id': department_id, }) obj.write({ 'cycle_item_id': cycle_item_id, diff --git a/netforce_clinic/models/schedule_copy.py b/netforce_clinic/models/schedule_copy.py index 61a5e29..539320b 100644 --- a/netforce_clinic/models/schedule_copy.py +++ b/netforce_clinic/models/schedule_copy.py @@ -90,18 +90,25 @@ class ScheduleCopy(Model): time_start=obj.schedule_id.time_start[11:] time_stop=obj.schedule_id.time_stop[11:] exist_date={} - for r in get_model("clinic.schedule").search_read([['date','>=',obj.date_from],['date','<=',(date_to+timedelta(days=8)).strftime(FMT_DATE)]],['date','state']): + dom=[] + dom.append(['date','>=',obj.date_from]) + dom.append(['date','<=',(date_to+timedelta(days=8)).strftime(FMT_DATE)]) + branch=schedule.branch_id + department=schedule.department_id + if branch: + dom.append(['branch_id','=',branch.id]) + if department: + dom.append(['department_id','=',department.id]) + for r in get_model("clinic.schedule").search_read(dom,['date','state']): exist_date.update({ r['date']:{ 'id': r['id'], 'date': r['date'], - 'state': r['state'] + 'state': r['state'], + 'branch_id': branch.id, + 'department_id': department.id, }}) - print('exist date') - print("="*50) - for k,v in exist_date.items(): - print(k) - print("="*50) + for weekday in days: wd=date_from.weekday() start_date=date_from @@ -125,17 +132,21 @@ class ScheduleCopy(Model): get_model("clinic.schedule").delete([eid]) print("delete ", exist_date) count+=7 # looking for next week if dow is not exist - print("x ", schedules) if date not in [v['date'] for k,v in exist_date.items()]+[schedule_date]: schedules.append({ 'date': date, + 'branch_id': branch.id, + 'department_id': department.id, 'lines': lines, }) else: - print("y ", schedules) - # copy to exist nurse - schds=get_model("clinic.schedule").search_browse([['date','=',date]]) - print("update lines ", lines) + print("copy to exist nurse ", lines) + dom2=[['date','=',date]] + if branch: + dom2.append(['branch_id','=',branch.id]) + if department: + dom2.append(['department_id','=',department.id]) + schds=get_model("clinic.schedule").search_browse(dom2) if schds and lines: schd=schds[0] for line in schd.lines: diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py index a63da40..15b5fd6 100644 --- a/netforce_clinic/models/visit.py +++ b/netforce_clinic/models/visit.py @@ -47,7 +47,7 @@ class Visit(Model): 'print_date': fields.Date('Print Date',function="_get_print_date"), 'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"), #XXX on_delete="cascade" -> rm visit from cycle item 'sequence': fields.Char("Sequence",function="_get_all",function_multi=True,store=True), - 'visit_date': fields.Date('Visit Date'), + 'visit_date': fields.Date('Date'), 'cycle_color': fields.Char('Color',function="_get_all",function_multi=True,store=True), 'note': fields.Text('Note'), 'branch_id': fields.Many2One("clinic.branch","Branch"),