fix pending
parent
b7d1fc74f2
commit
7fea2255bf
|
@ -1,3 +1,8 @@
|
||||||
dom=[['patient_id.field_bool','=',True]] => not working
|
dom=[['patient_id.field_bool','=',True]] => not working
|
||||||
|
|
||||||
pattern id card: 3 3013 00180 19 0
|
pattern id card: 3 3013 00180 19 0
|
||||||
|
|
||||||
|
--- receipt --
|
||||||
|
date should be the same
|
||||||
|
size of table should be fix per page
|
||||||
|
---- visit ---
|
||||||
|
should check key
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
<field name="lines" nolabel="1">
|
<field name="lines" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="nurse_id" domain='[["type","=","nurse"]]' onchange="onchange_nurse"/>
|
<field name="nurse_id" domain='[["type","=","nurse"]]' onchange="onchange_nurse"/>
|
||||||
<!--<field name="level_id" invisible="1"/>-->
|
<!--<field name="level_id"/>-->
|
||||||
<!--<field name="categ_id" invisible="1"/>-->
|
<!--<field name="categ_id"/>-->
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</tab>
|
</tab>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<related>
|
<related>
|
||||||
<field name="hd_cases"/>
|
<field name="hd_cases" readonly="1"/>
|
||||||
<field name="comments"/>
|
<field name="comments"/>
|
||||||
</related>
|
</related>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="branch_id"/>
|
<!--<field name="branch_id"/>-->
|
||||||
<field name="department_id"/>
|
<!--<field name="department_id"/>-->
|
||||||
<!--<field name="level_id"/>-->
|
<!--<field name="level_id"/>-->
|
||||||
<!--<field name="categ_id"/>-->
|
<!--<field name="categ_id"/>-->
|
||||||
<field name="image" preview="1"/>
|
<field name="image" preview="1"/>
|
||||||
|
|
|
@ -30,10 +30,13 @@ class HDCasePopupDlz(Model):
|
||||||
def new_dlz(self,ids,context={}):
|
def new_dlz(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
hd_case=obj.hd_case_id
|
hd_case=obj.hd_case_id
|
||||||
|
res={}
|
||||||
if hd_case:
|
if hd_case:
|
||||||
context['is_wiz']=True
|
context['is_wiz']=True
|
||||||
context['pop_id']=obj.id
|
context['pop_id']=obj.id
|
||||||
return hd_case.new_dialyzer(context=context)
|
res=hd_case.new_dialyzer(context=context)
|
||||||
|
print('res ', res)
|
||||||
|
return res
|
||||||
|
|
||||||
def onchange_product(self,context={}):
|
def onchange_product(self,context={}):
|
||||||
data=context['data']
|
data=context['data']
|
||||||
|
|
|
@ -247,6 +247,13 @@ class Patient(Model):
|
||||||
super().delete(ids)
|
super().delete(ids)
|
||||||
|
|
||||||
def write(self,ids,vals,**kw):
|
def write(self,ids,vals,**kw):
|
||||||
|
if 'type_id' in vals.keys():
|
||||||
|
#update patient in hd case which state is condition below
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
for hdcase in get_model('clinic.hd.case').search_browse([['patient_id','in',ids],['state','in',['draft','waiting_treatment']]]):
|
||||||
|
hdcase.write({
|
||||||
|
'patient_type_id': vals['type_id'],
|
||||||
|
})
|
||||||
if 'dispose' in vals.keys():
|
if 'dispose' in vals.keys():
|
||||||
if vals['dispose']:
|
if vals['dispose']:
|
||||||
vals['state']='dispose'
|
vals['state']='dispose'
|
||||||
|
|
|
@ -132,8 +132,50 @@ class ClinicSetting(Model):
|
||||||
})
|
})
|
||||||
|
|
||||||
def run_script(self,ids,context={}):
|
def run_script(self,ids,context={}):
|
||||||
files=['SS3-1.csv','SS4-1.csv','SS4.csv']
|
user_id=get_active_user()
|
||||||
self.update_patient_file(files)
|
if user_id !=1:
|
||||||
|
print("Only admin!!")
|
||||||
|
return
|
||||||
|
visits={}
|
||||||
|
for visit in get_model("clinic.visit").search_browse([]):
|
||||||
|
key='%s-%s'%(visit.visit_date, visit.patient_id.id)
|
||||||
|
if not key in visits.keys():
|
||||||
|
visits[key]=[]
|
||||||
|
hd_ids=[]
|
||||||
|
for hdcase in visit.hd_cases:
|
||||||
|
hd_ids.append(hdcase.id)
|
||||||
|
visits[key].append({
|
||||||
|
'id': visit.id,
|
||||||
|
'date': visit.visit_date,
|
||||||
|
'patient_id': visit.patient_id.id,
|
||||||
|
'state': visit.state,
|
||||||
|
'hd_ids': hd_ids,
|
||||||
|
})
|
||||||
|
for k, vs in visits.items():
|
||||||
|
if len(vs) > 1:
|
||||||
|
vids=[]
|
||||||
|
for v in vs:
|
||||||
|
if v['state']=='pending':
|
||||||
|
visit=get_model("clinic.visit").browse(v['id'])
|
||||||
|
for hdcase in visit.hd_cases:
|
||||||
|
hdcase.delete()
|
||||||
|
visit.delete()
|
||||||
|
print('deleted id ', v['id'], v['patient_id'], v['date'])
|
||||||
|
elif len(v['hd_ids']) < 1:
|
||||||
|
visit=get_model("clinic.visit").browse(v['id'])
|
||||||
|
if visit:
|
||||||
|
for hdcase in visit.hd_cases:
|
||||||
|
hdcase.delete()
|
||||||
|
visit.to_draft()
|
||||||
|
visit.delete()
|
||||||
|
print('deleted id ', v['id'], v['patient_id'], v['date'])
|
||||||
|
elif v['state'] in ('confirmed', 'cancelled'):
|
||||||
|
vids.append(v['id'])
|
||||||
|
print('need to delete id ', vids, vids[0])
|
||||||
|
|
||||||
|
|
||||||
|
#files=['SS3-1.csv','SS4-1.csv','SS4.csv']
|
||||||
|
#self.update_patient_file(files)
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
def update_patient_file(self,files=[]):
|
def update_patient_file(self,files=[]):
|
||||||
|
|
|
@ -98,6 +98,7 @@ class Visit(Model):
|
||||||
'nurse_id': _get_nurse,
|
'nurse_id': _get_nurse,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#_sql_constraints=("clinic_visit_key_uniq","unique(patient_id,visit_date,cycle_id,department_id)","Patient is already exist in this date"),
|
||||||
_order="sequence"
|
_order="sequence"
|
||||||
|
|
||||||
def new_dlz(self,patient_id,department_id):
|
def new_dlz(self,patient_id,department_id):
|
||||||
|
|
Loading…
Reference in New Issue