From 00c79ae4b41c84373d94444772827d8abb46f208 Mon Sep 17 00:00:00 2001 From: "saharat.i@netforce.co.th" Date: Thu, 23 Nov 2017 11:28:14 +0700 Subject: [PATCH] Edit select sickbad in HD Case (clinic_hd_case) --- netforce_clinic/layouts/clinic_sickbed_list.xml | 2 +- netforce_clinic/models/sickbed.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/netforce_clinic/layouts/clinic_sickbed_list.xml b/netforce_clinic/layouts/clinic_sickbed_list.xml index 78205cf..f13239a 100644 --- a/netforce_clinic/layouts/clinic_sickbed_list.xml +++ b/netforce_clinic/layouts/clinic_sickbed_list.xml @@ -3,7 +3,7 @@ - + diff --git a/netforce_clinic/models/sickbed.py b/netforce_clinic/models/sickbed.py index 693c414..604edae 100644 --- a/netforce_clinic/models/sickbed.py +++ b/netforce_clinic/models/sickbed.py @@ -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()