improvement

conv_bal
watcha.h@almacom.co.th 2015-06-03 11:39:08 +07:00
parent 157454f03b
commit 1a61b83116
8 changed files with 13 additions and 45 deletions

View File

@ -85,20 +85,6 @@
<field name="cstate"/>
</form>
</field>
<!--<field name="patients">-->
<field name="patients" attrs='{"readonly":1,"invisible":[["type","in",["nurse","staff"]]]}'>
<list>
<field name="reg_date"/>
<field name="hn_no"/>
<field name="trt_no"/>
<field name="card_no"/>
<field name="name"/>
<field name="type_id"/>
<field name="department_id"/>
<field name="walkin"/>
<field name="dispose"/>
</list>
</field>
<field name="comments"/>
</related>
</form>

View File

@ -1,4 +1,5 @@
from netforce.model import Model, fields
from netforce.access import get_active_user, set_active_user
class CycleItemLine(Model):
_name="clinic.cycle.item.line"
@ -6,6 +7,8 @@ class CycleItemLine(Model):
def _get_all(self,ids,context={}):
res={}
user_id=get_active_user()
set_active_user(1)
for obj in self.browse(ids):
citem=obj.cycle_item_id
pt_total=len([hdcase for hdcase in citem.hd_cases if hdcase.state in ('waiting_payment','paid')])
@ -13,6 +16,7 @@ class CycleItemLine(Model):
'cstate': citem.state,
'pt_total': pt_total,
}
set_active_user(user_id)
return res
_fields={

View File

@ -1458,8 +1458,6 @@ class HDCase(Model):
vals=self.get_hct(vals,patient_id)
new_id=super().create(vals,**kw)
self.function_store([new_id])
#obj=self.browse(new_id)
#self.check_hct(obj)
return new_id
def check_hct(self,obj):

View File

@ -410,7 +410,6 @@ class LaborCost(Model):
doctor_lines.append(('create',line))
else:
nurse_lines.append(('create',line))
obj.write({
'doctor_lines': doctor_lines,
'nurse_lines': nurse_lines,

View File

@ -31,7 +31,7 @@ class LaborCostLine(Model):
_fields={
"labor_cost_id": fields.Many2One("clinic.labor.cost","Labor Cost",required=True,on_delete="cascade"),
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Staff Type",required=True,search=True,function="_get_store",function_multi=True),
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Staff Type",required=True,search=True,function="_get_store",function_multi=True,store=True),
'staff_id': fields.Many2One("clinic.staff", "Staff",search=True),
'level_id': fields.Many2One("clinic.staff.level", "Level",search=True),
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True),

View File

@ -175,7 +175,7 @@ class Patient(Model):
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walkin"),
'department_names': fields.Text("Departments",function="_get_department_names"),
#'department_names': fields.Text("Departments",function="_get_department_names"),
'location': fields.Char("Location"), #to filter
}

View File

@ -99,8 +99,12 @@ class Staff(Model):
def _get_location(self,ids,context={}):
res={}
user_id=get_active_user()
set_active_user(1)
for obj in self.browse(ids):
res[obj.id]=",".join([d.code for d in obj.departments])
st_codes=set([d.code for d in obj.departments])
res[obj.id]=",".join([dcode for dcode in sorted(st_codes)])
set_active_user(user_id)
return res
def _get_department_names(self,ids,context={}):
@ -108,26 +112,11 @@ class Staff(Model):
user_id=get_active_user()
set_active_user(1)
for obj in self.browse(ids):
res[obj.id]=','.join([dpt.name for dpt in obj.departments])
dpt_st=set([dpt.name for dpt in obj.departments])
res[obj.id]=','.join([dpt_name for dpt_name in sorted(dpt_st)])
set_active_user(user_id)
return res
def _get_all(self,ids,context={}):
res={}
for obj in self.browse(ids):
pt_ids=[]
if obj.type=='doctor':
pt_ids=get_model("clinic.patient").search([['doctor_id','=',obj.id]])
elif obj.type=='nurse':
p=set()
for cline in obj.cycle_item_lines:
citem=cline.cycle_item_id
for hdcase in citem.hd_cases:
p.update({hdcase.patient_id.id})
pt_ids=list(p)
res[obj.id]=pt_ids
return res
_fields={
'employee_id': fields.Many2One("hr.employee","Employee"),
"number": fields.Char("Number",required=True,search=True),
@ -154,8 +143,6 @@ class Staff(Model):
"prof_license_expiry" : fields.Date("Expired License"),
"birthday": fields.Date("BirthDay",search=True),
"department_id": fields.Many2One("clinic.department", "Department",search=True),
#"patients": fields.One2Many("clinic.patient","doctor_id","Patients"),
"patients": fields.Many2Many("clinic.patient","Patients",function="_get_all"),
"addresses": fields.One2Many("address","staff_id","Addresses"),
"comments": fields.One2Many("message","related_id","Comments"),
"nurse_visits": fields.One2Many("clinic.visit","nurse_id","Visits"),

View File

@ -75,12 +75,6 @@
<div>
<a href="#name=clinic_visit_board">{{t "Visit Board"}}</a>
</div>
<div>
<a href="#name=clinic_visit&mode=form">{{t "New Visit"}}</a>
</div>
<div>
<a href="#name=clinic_make_apt">{{t "Make An Appointment"}}</a>
</div>
</div>
<div class="nf-board-title">
<h3>{{t "HD Cases"}}</h3>