improve make an appointment
parent
dad6af8a8e
commit
843f7c1d2f
|
@ -8,7 +8,7 @@
|
|||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||
<field name="lines" nolabel="1">
|
||||
<list>
|
||||
<field name="patient_id"/>
|
||||
<field name="patient_id" onchange="onchange_patient"/>
|
||||
<field name="department_id"/>
|
||||
<field name="mon_cycle_id"/>
|
||||
<field name="tue_cycle_id"/>
|
||||
|
|
|
@ -321,7 +321,7 @@ class HDCase(Model):
|
|||
due_amt=0.0
|
||||
rmb_amt=0.0
|
||||
for line in data['lines']:
|
||||
amt=line['amount'] or 0.0
|
||||
amt=line.get('amount', 0.0)
|
||||
reimbursable=line.get('reimbursable','no')
|
||||
if reimbursable=='yes':
|
||||
rmb_amt+=amt
|
||||
|
|
|
@ -4,6 +4,7 @@ from calendar import monthrange
|
|||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_user
|
||||
from netforce.utils import get_data_path
|
||||
|
||||
DRT=0
|
||||
FMT_DATE="%Y-%m-%d"
|
||||
|
@ -230,7 +231,7 @@ class MakeAPT(Model):
|
|||
vids=visit_obj.search(dom)
|
||||
if not vids:
|
||||
visit_vals.append(vals)
|
||||
count+=7
|
||||
count+=7 #XXX
|
||||
start_date=tmp
|
||||
user_id=get_active_user()
|
||||
staff_ids=get_model("clinic.staff").search([['type','=','type'],['user_id','=',user_id]])
|
||||
|
@ -269,4 +270,34 @@ class MakeAPT(Model):
|
|||
data['department_id']=None
|
||||
return data
|
||||
|
||||
def onchange_patient(self,context={}):
|
||||
data=context['data']
|
||||
path=context['path']
|
||||
line=get_data_path(data,path,parent=True)
|
||||
patient_id=line['patient_id']
|
||||
patient=get_model("clinic.patient").browse(patient_id)
|
||||
department_id=None
|
||||
if patient.department_id:
|
||||
department_id=patient.department_id.id
|
||||
line['department_id']=department_id
|
||||
for cycle in patient.cycles:
|
||||
cycle_id=cycle.cycle_id.id
|
||||
day=cycle.day
|
||||
print('day ', day)
|
||||
if day=='mon':
|
||||
line['mon_cycle_id']=cycle_id
|
||||
elif day=='tue':
|
||||
line['tue_cycle_id']=cycle_id
|
||||
elif day=='wed':
|
||||
line['wed_cycle_id']=cycle_id
|
||||
elif day=='thu':
|
||||
line['thu_cycle_id']=cycle_id
|
||||
elif day=='fri':
|
||||
line['fri_cycle_id']=cycle_id
|
||||
elif day=='sat':
|
||||
line['sat_cycle_id']=cycle_id
|
||||
elif day=='sun':
|
||||
line['sun_cycle_id']=cycle_id
|
||||
return data
|
||||
|
||||
MakeAPT.register()
|
||||
|
|
|
@ -122,6 +122,27 @@ class ClinicSetting(Model):
|
|||
return
|
||||
|
||||
def run_script(self,ids,context={}):
|
||||
user_id=get_active_user()
|
||||
if user_id !=1:
|
||||
print("Only admin!!")
|
||||
return
|
||||
pids=get_model("clinic.patient").search([['state','=','dispose']])
|
||||
count=0
|
||||
for visit in get_model("clinic.visit").search_browse([['patient_id','in',pids]]):
|
||||
if visit.state=='confirmed':
|
||||
continue
|
||||
visit.to_draft()
|
||||
hdcase=visit.hd_case_id
|
||||
if hdcase:
|
||||
hdcase.to_draft()
|
||||
hdcase.delete()
|
||||
visit.delete()
|
||||
count+=1
|
||||
print("count ", count)
|
||||
print("Done!")
|
||||
return
|
||||
|
||||
def export_staff_rotation_csv(self,ids,context={}):
|
||||
user_id=get_active_user()
|
||||
if user_id !=1:
|
||||
print("Only admin!!")
|
||||
|
|
Loading…
Reference in New Issue