add some filter

conv_bal
watcha.h@almacom.co.th 2015-01-19 12:34:50 +07:00
parent faaeb2146c
commit 0af24d9bd1
6 changed files with 30 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<board> <board>
<hpanel> <hpanel>
<widget action="clinic_visit_widget" string="Current Visit" span="12"/> <widget action="clinic_visit_widget" string="Visit Pending" span="12"/>
<!--<widget action="clinic_recent_patient_widget" string="Recent Patient"/>--> <!--<widget action="clinic_recent_patient_widget" string="Recent Patient"/>-->
<!--<widget action="clinic_cycle_widget" string="Average Cycle"/>--> <!--<widget action="clinic_cycle_widget" string="Average Cycle"/>-->
</hpanel> </hpanel>

View File

@ -1,8 +1,11 @@
<form model="clinic.make.apt" title="Make An Appoitment"> <form model="clinic.make.apt" title="Make An Appoitment">
<separator string="1. Select Period > 2. Click Load Data > 3. Select Patient > 4. Generate Visit"/> <separator string="1. Select Period And Add Some Filter> 2. Click Load Data > 3. Select Patient > 4. Generate Visit"/>
<field name="date" span="3" mode="month" onchange="onchange_date"/> <field name="date" span="2" mode="month" onchange="onchange_date"/>
<field name="date_from" span="3"/> <field name="date_from" span="2"/>
<field name="date_to" span="3"/> <field name="date_to" span="2"/>
<field name="department_id" span="2"/>
<field name="branch_id" span="2"/>
<field name="cycle_id" span="2"/>
<field name="lines" nolabel="1"> <field name="lines" nolabel="1">
<list> <list>
<field name="patient_id"/> <field name="patient_id"/>

View File

@ -6,11 +6,5 @@
<field name="patient_id" span="2"/> <field name="patient_id" span="2"/>
<field name="doctor_id" span="2"/> <field name="doctor_id" span="2"/>
<field name="department_id" span="2"/> <field name="department_id" span="2"/>
<!--<group span="1" columns="1">--> <field name="branch_id" span="2"/>
<!--<button string="New Visit" method="make_visit" span="1" icon="plus" type="success" size="small"/>-->
<!--</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>-->
</form> </form>

View File

@ -4,6 +4,8 @@
<field name="visit_date"/> <field name="visit_date"/>
<field name="patient_id"/> <field name="patient_id"/>
<field name="doctor_id"/> <field name="doctor_id"/>
<field name="department_id"/>
<field name="branch_id"/>
<field name="state"/> <field name="state"/>
<!--<field name="cycle_color" invisible="1"/>--> <!--<field name="cycle_color" invisible="1"/>-->
</list> </list>

View File

@ -17,6 +17,9 @@ class MakeAPT(Model):
"date": fields.Date("Month"), "date": fields.Date("Month"),
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
'department_id': fields.Many2One("clinic.department","Department"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
"lines": fields.One2Many("clinic.make.apt.line","apt_id","Lines"), "lines": fields.One2Many("clinic.make.apt.line","apt_id","Lines"),
} }
@ -38,7 +41,16 @@ class MakeAPT(Model):
def load(self,ids,context={}): def load(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
pts={} pts={}
for pc in get_model("clinic.patient.cycle").search_browse([]): dom=[]
if obj.department_id:
dom.append(['department_id','=',obj.department_id.id])
if obj.cycle_id:
dom.append(['cycle_id','=',obj.cycle_id.id])
branch_id=obj.branch_id.id
for pc in get_model("clinic.patient.cycle").search_browse(dom):
branch=pc.department_id.branch_id
if branch_id and branch_id!=branch.id:
continue
patient=pc.patient_id patient=pc.patient_id
dpt=pc.department_id dpt=pc.department_id
key=(patient.id,dpt.id) key=(patient.id,dpt.id)

View File

@ -31,8 +31,9 @@ class VisitBoard(Model):
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient"),
'cycle_id': fields.Many2One("clinic.cycle","Cycle"), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
'department_id': fields.Many2One("clinic.department","Department"),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[["type","=","doctor"]]), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[["type","=","doctor"]]),
'department_id': fields.Many2One("clinic.department","Department"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
} }
_defaults={ _defaults={
@ -51,6 +52,7 @@ class VisitBoard(Model):
cycle_id=None cycle_id=None
doctor_id=None doctor_id=None
department_id=None department_id=None
branch_id=None
if ids: if ids:
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
date_from=obj.date_from date_from=obj.date_from
@ -59,6 +61,7 @@ class VisitBoard(Model):
cycle_id=obj.cycle_id.id cycle_id=obj.cycle_id.id
doctor_id=obj.doctor_id.id doctor_id=obj.doctor_id.id
department_id=obj.department_id.id department_id=obj.department_id.id
branch_id=obj.branch_id.id
time_start='%s 00:00:00'%(date_from) time_start='%s 00:00:00'%(date_from)
time_stop='%s 23:59:59'%(date_to) time_stop='%s 23:59:59'%(date_to)
@ -74,6 +77,8 @@ class VisitBoard(Model):
dom.append(['doctor_id','=',doctor_id]) dom.append(['doctor_id','=',doctor_id])
if department_id: if department_id:
dom.append(['department_id','=',department_id]) dom.append(['department_id','=',department_id])
if branch_id:
dom.append(['branch_id','=',branch_id])
lines=[] lines=[]
empty_line={ empty_line={