diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index 4f3b2e6..bc7f0d1 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -36,7 +36,7 @@
-
+
-
diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml
index 416342e..fabca02 100644
--- a/netforce_clinic/layouts/clinic_patient_form.xml
+++ b/netforce_clinic/layouts/clinic_patient_form.xml
@@ -16,6 +16,7 @@
+
@@ -39,11 +40,11 @@
-
+
-
+
@@ -106,7 +107,7 @@
-
+
diff --git a/netforce_clinic/layouts/clinic_visit_form.xml b/netforce_clinic/layouts/clinic_visit_form.xml
index 240967e..a6c7967 100644
--- a/netforce_clinic/layouts/clinic_visit_form.xml
+++ b/netforce_clinic/layouts/clinic_visit_form.xml
@@ -30,6 +30,7 @@
+
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index aa86eb1..c2ac3c8 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -346,25 +346,22 @@ class Patient(Model):
pt.delete()
super().delete(ids)
+ def check_vals(self,vals):
+ return vals
+
def write(self,ids,vals,**kw):
if 'cycles' in vals.keys():
- index=0
- for cvals in vals['cycles']:
- mode=cvals[0]
- if mode=='delete':
- continue
- elif mode=='create':
- cycle_vals=cvals[1]
- elif mode=='write':
- continue
- cycle_vals=cvals[2]
- cdom=[]
- for f, v in cycle_vals.items():
- cdom.append([f,'=',v])
- print('cdom ', cdom)
- for c in get_model('clinic.patient.cycle').search_browse(cdom):
- c.delete()
- index+=1
+ datenow=time.strftime("%Y-%m-%d")
+ vdom=[
+ ['patient_id','in',ids],
+ ['visit_date','>',datenow],
+ ['state','=','pending'],
+ ['manual','=',False],
+ ]
+ visit_ids=get_model("clinic.visit").search(vdom)
+ print('removing visit .. ', len(visit_ids))
+ get_model("clinic.visit").delete(visit_ids)
+
if 'type_id' in vals.keys():
#update patient in hd case which state is condition below
for obj in self.browse(ids):
diff --git a/netforce_clinic/models/patient_cycle.py b/netforce_clinic/models/patient_cycle.py
index 0ed861e..85886df 100644
--- a/netforce_clinic/models/patient_cycle.py
+++ b/netforce_clinic/models/patient_cycle.py
@@ -20,7 +20,7 @@ class PatientCycle(Model):
'department_id': _get_department,
}
- _sql_constraints=("pcycle_uniq","unique(patient_id,cycle_id,day,department_id)","patient_id,cycle_id,day,department_id should be unique"),
+ __sql_constraints=("pcycle_uniq","unique(patient_id,cycle_id,day,department_id)","patient_id,cycle_id,day,department_id should be unique"),
_order="department_id,cycle_id"
PatientCycle.register()
diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py
index bbd49f4..eda35cb 100644
--- a/netforce_clinic/models/visit.py
+++ b/netforce_clinic/models/visit.py
@@ -52,6 +52,7 @@ class Visit(Model):
'cycle_color': fields.Char('Color',function="_get_all",function_multi=True,store=True),
'note': fields.Text('Note'),
'branch_id': fields.Many2One("clinic.branch","Branch"),
+ 'manual': fields.Boolean("Manual Tempolary Visit"),
}
def _get_number(self,context={}):
@@ -97,6 +98,7 @@ class Visit(Model):
"number": "/",
"company_id": lambda *a: get_active_company(),
'nurse_id': _get_nurse,
+ 'manual': False,
}
#_sql_constraints=("clinic_visit_key_uniq","unique(patient_id,visit_date,cycle_id,department_id)","Patient is already exist in this date"),
diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs
index b4759d8..352f00e 100644
--- a/netforce_clinic/templates/visit_board.hbs
+++ b/netforce_clinic/templates/visit_board.hbs
@@ -37,9 +37,9 @@
{{number}}
{{else}}
{{#ifeq number "Cancelled"}}
- {{number}}
+ {{number}}
{{else}}
- {{number}}
+ {{number}}
{{/ifeq}}
{{/ifeq}}
@@ -65,15 +65,15 @@
-->
{{else}}
{{#ifeq hd_case_state "waiting_treatment"}}
-
+
{{else}}
{{#ifeq hd_case_state "in_progress"}}
-
+
{{else}}
{{#ifeq hd_case_state "cancelled"}}
-
+
{{else}}
-
+
{{/ifeq}}
{{/ifeq}}
{{/ifeq}}