dpt & branch (need sharing setting for each nurse)
parent
e177f2744f
commit
b8ff75b412
|
@ -1,10 +1,10 @@
|
|||
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]],"#70DB93":[["state","=","paid"]]}'>
|
||||
<field name="number"/>
|
||||
<field name="date"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="patient_type_id"/>
|
||||
<field name="sickbed_id"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="state"/>
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
<tab string="General">
|
||||
<group form_layout="stacked">
|
||||
<field name="date" span="3" onchange="onchange_date"/>
|
||||
<field name="department_id" span="3"/>
|
||||
<field name="branch_id" span="3"/>
|
||||
<field name="lines" nolabel="1">
|
||||
<list>
|
||||
<field name="cycle_id"/>
|
||||
|
@ -22,7 +24,6 @@
|
|||
</list>
|
||||
</field>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="branch_id" invisible="1"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Planning">
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<list model="clinic.schedule">
|
||||
<field name="date"/>
|
||||
<field name="department_id"/>
|
||||
<field name="branch_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<field name="name_eng"/>
|
||||
<field name="nick_name"/>
|
||||
<field name="branch_id" required="1"/>
|
||||
<field name="department_id"/>
|
||||
<field name="department_id" required="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<search model="clinic.visit">
|
||||
<field name="visit_date"/>
|
||||
<field name="number"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="visit_date"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="branch_id"/>
|
||||
</search>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"),
|
||||
|
|
Loading…
Reference in New Issue