Edit select sickbad in HD Case (clinic_hd_case)
parent
54af83fcfa
commit
00c79ae4b4
|
@ -3,7 +3,7 @@
|
|||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="image" preview="1"/>
|
||||
<!--<field name="image" preview="1"/>-->
|
||||
<field name="department_id"/>
|
||||
<field name="branch_id"/>
|
||||
<field name="note"/>
|
||||
|
|
|
@ -11,18 +11,19 @@ class SickBed(Model):
|
|||
for obj in self.browse(ids):
|
||||
hd_case=None
|
||||
patient_id=None
|
||||
image=None
|
||||
#image=None
|
||||
date=''
|
||||
set_active_user(1) #FIXME permission denined because of department of patient
|
||||
if obj.hd_cases:
|
||||
hd_case=sorted(obj.hd_cases, key=lambda a: a.id)[-1]
|
||||
#hd_case=sorted(obj.hd_cases, key=lambda a: a.id)[-1]
|
||||
hd_case=obj.hd_cases[-1]
|
||||
patient=hd_case.patient_id
|
||||
patient_id=patient.id
|
||||
image=patient.image
|
||||
#image=patient.image
|
||||
date=hd_case.date
|
||||
res[obj.id]={
|
||||
'patient_id': patient_id,
|
||||
'image': image,
|
||||
#'image': image,
|
||||
'date': date,
|
||||
}
|
||||
set_active_user(get_active_user())
|
||||
|
@ -34,7 +35,7 @@ class SickBed(Model):
|
|||
'hd_cases': fields.One2Many("clinic.hd.case",'sickbed_id','HDCases'),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
'patient_id': fields.Many2One("clinic.patient","Lasted Patient",function="_get_all",function_multi=True,domain=[['state','=','admit']]),
|
||||
'image': fields.File("Image",function="_get_all",function_multi=True),
|
||||
#'image': fields.File("Image",function="_get_all",function_multi=True),
|
||||
'date': fields.Date("Lasted Date",function="_get_all",function_multi=True),
|
||||
"state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"),
|
||||
'sequence': fields.Integer("Sequence"),
|
||||
|
@ -43,6 +44,8 @@ class SickBed(Model):
|
|||
'department_id': fields.Many2One("clinic.department","Department",required=True, search=True),
|
||||
'active': fields.Boolean("Active"),
|
||||
}
|
||||
|
||||
_order="name desc"
|
||||
|
||||
def _get_branch(self,context={}):
|
||||
user_id=get_active_user()
|
||||
|
|
Loading…
Reference in New Issue