report visit summary
parent
b8fa64d373
commit
a90c01c4d9
|
@ -4,4 +4,5 @@
|
||||||
<field name="date_to" span="2"/>
|
<field name="date_to" span="2"/>
|
||||||
<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="state" span="2"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -198,8 +198,8 @@ class Patient(Model):
|
||||||
if not vals['active']:
|
if not vals['active']:
|
||||||
vals['resign_date']=time.strftime("%Y-%m-%d")
|
vals['resign_date']=time.strftime("%Y-%m-%d")
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
if not obj.addresses:
|
#if not obj.addresses:
|
||||||
raise Exception("Address not found - %s!"%obj.name)
|
#raise Exception("Address not found - %s!"%obj.name)
|
||||||
partner_id=obj.partner_id
|
partner_id=obj.partner_id
|
||||||
if not partner_id:
|
if not partner_id:
|
||||||
for partner in get_model("partner").search_browse([['name', '=', obj.name]]):
|
for partner in get_model("partner").search_browse([['name', '=', obj.name]]):
|
||||||
|
|
|
@ -17,6 +17,7 @@ class ReportVisit(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"),
|
||||||
"doctor_id": fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
|
"doctor_id": fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
|
||||||
|
"state": fields.Selection([["draft","Draft"],['pending','Pending'],["confirmed","Confirmed"],["cancelled","Cancelled"]],"Status",required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_date_from(self,context={}):
|
def _get_date_from(self,context={}):
|
||||||
|
@ -32,6 +33,7 @@ class ReportVisit(Model):
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
'date_from': _get_date_from,
|
'date_from': _get_date_from,
|
||||||
'date_to': _get_date_to,
|
'date_to': _get_date_to,
|
||||||
|
'state': 'pending',
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
|
@ -50,6 +52,7 @@ class ReportVisit(Model):
|
||||||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||||
patient_id=None
|
patient_id=None
|
||||||
doctor_id=None
|
doctor_id=None
|
||||||
|
state=None
|
||||||
if ids:
|
if ids:
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
month=obj.date_from.split("-")[1]
|
month=obj.date_from.split("-")[1]
|
||||||
|
@ -57,15 +60,17 @@ class ReportVisit(Model):
|
||||||
time_stop=obj.date_to
|
time_stop=obj.date_to
|
||||||
patient_id=obj.patient_id.id
|
patient_id=obj.patient_id.id
|
||||||
doctor_id=obj.doctor_id.id
|
doctor_id=obj.doctor_id.id
|
||||||
|
state=obj.state
|
||||||
# new patient of this month
|
# new patient of this month
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['state','=','pending'])
|
|
||||||
dom.append(['visit_date','>=',time_start])
|
dom.append(['visit_date','>=',time_start])
|
||||||
dom.append(['visit_date','<=',time_stop])
|
dom.append(['visit_date','<=',time_stop])
|
||||||
if patient_id:
|
if patient_id:
|
||||||
dom.append(['patient_id','=',patient_id])
|
dom.append(['patient_id','=',patient_id])
|
||||||
if doctor_id:
|
if doctor_id:
|
||||||
dom.appen(['doctor_id','=',doctor_id])
|
dom.append(['doctor_id','=',doctor_id])
|
||||||
|
if state:
|
||||||
|
dom.append(['state','=',state])
|
||||||
|
|
||||||
records=get_model('clinic.visit').search_browse(dom)
|
records=get_model('clinic.visit').search_browse(dom)
|
||||||
lines=[]
|
lines=[]
|
||||||
|
|
Loading…
Reference in New Issue