show name department
parent
edf9f83901
commit
03116925db
|
@ -11,7 +11,7 @@
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="type_id"/>
|
<field name="type_id"/>
|
||||||
<!--<field name="branch_id"/>-->
|
<!--<field name="branch_id"/>-->
|
||||||
<field name="department_id"/>
|
<field name="department_names"/>
|
||||||
<field name="doctor_id"/>
|
<field name="doctor_id"/>
|
||||||
<!--<field name="image" preview='1'/>-->
|
<!--<field name="image" preview='1'/>-->
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="location"/>
|
<field name="department_names"/>
|
||||||
<!--<field name="branch_id"/>-->
|
|
||||||
<!--<field name="department_id"/>-->
|
|
||||||
<!--<field name="level_id"/>-->
|
|
||||||
<!--<field name="categ_id"/>-->
|
|
||||||
<field name="image" preview="1"/>
|
<field name="image" preview="1"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -78,6 +78,12 @@ class Patient(Model):
|
||||||
res[obj.id]=','.join([code for code in dpt_codes if code])
|
res[obj.id]=','.join([code for code in dpt_codes if code])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _get_department_names(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
res[obj.id]=','.join([dpt.name for dpt in obj.departments])
|
||||||
|
return res
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("HN Number",required=True,search=True),
|
"number": fields.Char("HN Number",required=True,search=True),
|
||||||
"trt_no": fields.Char("TRT",search=True),
|
"trt_no": fields.Char("TRT",search=True),
|
||||||
|
@ -148,6 +154,7 @@ class Patient(Model):
|
||||||
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
|
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
|
||||||
'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walk In"),
|
'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walk In"),
|
||||||
'departments': fields.Many2Many("clinic.department","Departments"),
|
'departments': fields.Many2Many("clinic.department","Departments"),
|
||||||
|
'department_names': fields.Text("Departments",function="_get_department_names"),
|
||||||
'location': fields.Char("Location",function="_get_location",store=True), #to filter
|
'location': fields.Char("Location",function="_get_location",store=True), #to filter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +217,7 @@ class Patient(Model):
|
||||||
'departments': _get_departments,
|
'departments': _get_departments,
|
||||||
}
|
}
|
||||||
|
|
||||||
_sql_constraints=("clinic_patient_key_uniq","unique(name_check)","name should be unique"),
|
_sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"),
|
||||||
_order="reg_date desc"
|
_order="reg_date desc"
|
||||||
|
|
||||||
def check_idcard(self,idcard=''):
|
def check_idcard(self,idcard=''):
|
||||||
|
|
|
@ -150,28 +150,15 @@ class ClinicSetting(Model):
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
# update
|
# update
|
||||||
for pt in get_model("clinic.patient").search_browse([]):
|
db=get_connection()
|
||||||
dpt=pt.department_id
|
res=db.query("select id, day from clinic_patient_cycle")
|
||||||
dpt_ids=set()
|
for r in res:
|
||||||
for cc in pt.cycles:
|
day=r['day'] or ""
|
||||||
dp=cc.department_id
|
if day.isdigit():
|
||||||
vals={}
|
pc=get_model('clinic.patient.cycle').browse(r['id'])
|
||||||
if not dp:
|
pc.write({
|
||||||
vals.update({
|
'day': DAYS[int(r['day'])],
|
||||||
'department_id': dpt.id,
|
})
|
||||||
})
|
|
||||||
if (dp.day or "").isdigit():
|
|
||||||
day=DAYS[int(dp.day)]
|
|
||||||
vals.update({
|
|
||||||
'day': day,
|
|
||||||
})
|
|
||||||
cc.write(vals)
|
|
||||||
dp=dp or dpt
|
|
||||||
dpt_ids.update({dp.id})
|
|
||||||
dpt_ids=list(dpt_ids)
|
|
||||||
pt.write({
|
|
||||||
'departments': [('set',dpt_ids)],
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
### remove douplicate visit
|
### remove douplicate visit
|
||||||
visits={}
|
visits={}
|
||||||
|
|
|
@ -100,6 +100,12 @@ class Staff(Model):
|
||||||
res[obj.id]=",".join([d.code for d in obj.departments])
|
res[obj.id]=",".join([d.code for d in obj.departments])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _get_department_names(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
res[obj.id]=','.join([dpt.name for dpt in obj.departments])
|
||||||
|
return res
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
'employee_id': fields.Many2One("hr.employee","Employee"),
|
'employee_id': fields.Many2One("hr.employee","Employee"),
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
|
@ -155,6 +161,7 @@ class Staff(Model):
|
||||||
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
|
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
|
||||||
"partner_id": fields.Many2One("partner","Contact"),
|
"partner_id": fields.Many2One("partner","Contact"),
|
||||||
'departments': fields.Many2Many("clinic.department","Departments"),
|
'departments': fields.Many2Many("clinic.department","Departments"),
|
||||||
|
'department_names': fields.Text("Departments",function="_get_department_names"),
|
||||||
"location": fields.Char("Location",function="_get_location",store=True),
|
"location": fields.Char("Location",function="_get_location",store=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue