gen visit

conv_bal
watcha.h@almacom.co.th 2015-01-11 20:58:51 +07:00
parent 238f2f35b4
commit fff0b61903
5 changed files with 17 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<field name="time_stop" span="2"/>
<field name="cycle_id" onchange="onchange_cycle" span="2"/>
<field name="patient_categ_id" span="2"/>
<field name="patient_type" span="2"/>
<field name="patient_type_id" span="2"/>
<field name="doctor_id" span="2"/>
<field name="department_id" span="2"/>
<field name="nurse_categ_id" span="2"/>

View File

@ -8,6 +8,6 @@
</group>
<group span="2" columns="1">
<button string="Make An Appointment" action="clinic_gen_visit_form" span="1" icon="calendar" type="default" size="small"/>
<!--<button string="Calendar" offset="10" icon="calendar" size="small"/>-->
</group>
<!--<button string="calendar" icon="calendar" size="small" span="1"/>-->
</form>

View File

@ -13,7 +13,7 @@ class GenVisit(Model):
_fields={
'date_from': fields.Date("From", required=True),
'date_to': fields.Date("To", required=True),
'time_start': fields.Char("Time start"),
'time_start': fields.Char("Time Start"),
'time_stop': fields.Char("Time Stop"),
'cycle_id': fields.Many2One("clinic.cycle","Cycle", required=True),
'patient_lines': fields.One2Many("clinic.gen.visit.line","gen_id","Patient Lines"),
@ -27,7 +27,8 @@ class GenVisit(Model):
'sunday': fields.Boolean("Sunday"),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
'department_id': fields.Many2One("clinic.department","Department"),
"patient_type": fields.Selection([("s","Social Security"),("u","UC."),("others","Others")],"Patient Type"),
#"patient_type": fields.Selection([("s","Social Security"),("u","UC."),("others","Others")],"Patient Type"),
'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type"),
'patient_categ_id': fields.Many2One("clinic.patient.categ", "Patient Category"),
'nurse_categ_id': fields.Many2One("clinic.staff.categ", "Nurse Category", domain=[['type','=','nurse']]),
}
@ -84,7 +85,6 @@ class GenVisit(Model):
'nurse_id': _get_nurse,
'duration': 2,
'cycle_id': _get_cycle,
#'monday': True, # dynamic select weekday, use default_get
}
def default_get(self,field_names=None,context=None,**kw):
@ -130,10 +130,10 @@ class GenVisit(Model):
date_from=datetime.strptime(obj.date_from,FMT_DATE)
date_to=datetime.strptime(obj.date_to,FMT_DATE)
patients=[p.patient_id.id for p in obj.patient_lines if p.patient_id]
if not patients and obj.patient_type:
patients=get_model("clinic.patient").search([['type','=',obj.patient_type]])
if not patients and obj.patient_type_id:
patients=get_model("clinic.patient").search([['type_id','=',obj.patient_type_id.id]])
if not patients:
raise Exception("No patient for type %s"%obj.patient_type)
raise Exception("No patient for type %s"%obj.patient_type_id.name)
elif not patients and obj.patient_categ_id:
patients=get_model("clinic.patient").search([['categ_id','=',obj.patient_categ_id.id]])
if not patients:
@ -153,13 +153,14 @@ class GenVisit(Model):
'id': nurse.id,
'level_id': nurse.level_id.id,
})
#XXX
if not nurse_vals:
if not nurse_vals and obj.nurse_categ_id:
for nurse in get_model("clinic.staff").search_browse([['type','=','nurse'],['categ_id','=',obj.nurse_categ_id.id]]):
nurse_vals.append({
'id': nurse.id,
'level_id': nurse.level_id.id,
})
schedules={}
cycle=obj.cycle_id
cstart='%s:00'%cycle.time_start

View File

@ -26,7 +26,7 @@ class VisitBoard(Model):
_transient=True
_fields={
"date": fields.Date("Month", required=True),
"date": fields.Date("Month", required=False),
"date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True),
'patient_id': fields.Many2One("clinic.patient","Patient"),

View File

@ -1,10 +1,10 @@
=====
- visit
- color
- generate
nurses too much copy
- access right
- fix bug
- calendar
- schedule
- import
- diffrent user branch
=====
create button reset at setting
- backup master data