diff --git a/netforce_clinic/layouts/clinic_report_visit.xml b/netforce_clinic/layouts/clinic_report_visit.xml
index fe0b2e7..abb6388 100644
--- a/netforce_clinic/layouts/clinic_report_visit.xml
+++ b/netforce_clinic/layouts/clinic_report_visit.xml
@@ -4,4 +4,5 @@
+
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index eea23f7..9c54eae 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -198,8 +198,8 @@ class Patient(Model):
if not vals['active']:
vals['resign_date']=time.strftime("%Y-%m-%d")
for obj in self.browse(ids):
- if not obj.addresses:
- raise Exception("Address not found - %s!"%obj.name)
+ #if not obj.addresses:
+ #raise Exception("Address not found - %s!"%obj.name)
partner_id=obj.partner_id
if not partner_id:
for partner in get_model("partner").search_browse([['name', '=', obj.name]]):
diff --git a/netforce_clinic/models/report_visit.py b/netforce_clinic/models/report_visit.py
index 556d48e..8a8ba6e 100644
--- a/netforce_clinic/models/report_visit.py
+++ b/netforce_clinic/models/report_visit.py
@@ -17,6 +17,7 @@ class ReportVisit(Model):
"date_to": fields.Date("To", required=True),
"patient_id": fields.Many2One("clinic.patient","Patient"),
"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={}):
@@ -32,6 +33,7 @@ class ReportVisit(Model):
'date': lambda *a: time.strftime("%Y-%m-%d"),
'date_from': _get_date_from,
'date_to': _get_date_to,
+ 'state': 'pending',
}
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)
patient_id=None
doctor_id=None
+ state=None
if ids:
obj=self.browse(ids)[0]
month=obj.date_from.split("-")[1]
@@ -57,15 +60,17 @@ class ReportVisit(Model):
time_stop=obj.date_to
patient_id=obj.patient_id.id
doctor_id=obj.doctor_id.id
+ state=obj.state
# new patient of this month
dom=[]
- dom.append(['state','=','pending'])
dom.append(['visit_date','>=',time_start])
dom.append(['visit_date','<=',time_stop])
if patient_id:
dom.append(['patient_id','=',patient_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)
lines=[]