diff --git a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml
index 9614809..1208c08 100644
--- a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml
@@ -1,6 +1,10 @@
diff --git a/netforce_clinic/layouts/clinic_patient_cycle_list.xml b/netforce_clinic/layouts/clinic_patient_cycle_list.xml
index c87580a..9495007 100644
--- a/netforce_clinic/layouts/clinic_patient_cycle_list.xml
+++ b/netforce_clinic/layouts/clinic_patient_cycle_list.xml
@@ -1,5 +1,6 @@
+
diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml
index 907be90..ed436a5 100644
--- a/netforce_clinic/layouts/clinic_setting.xml
+++ b/netforce_clinic/layouts/clinic_setting.xml
@@ -26,8 +26,7 @@
-
-
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 3c156ed..69bff08 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -866,11 +866,32 @@ class HDCase(Model):
def new_dialyzer(self,ids,context={}):
obj=self.browse(ids)[0]
- dlz_vals=get_model("clinic.dialyzer").default_get()
- dlz_vals['patient_id']=obj.patient_id.id
- dlz_vals['company_id']=dlz_vals['company_id'][0]
- product_name=dlz_vals['product_id'][1]
- dlz_vals['product_id']=dlz_vals['product_id'][0]
+ is_wiz=context.get("is_wiz")
+ dlz_vals={}
+ if is_wiz:
+ pop_id=context.get('pop_id')
+ if pop_id:
+ pop=get_model("clinic.hd.case.popup.dlz").browse(pop_id)
+ prod=pop.product_id
+ dlz_vals={
+ 'product_id': prod.id,
+ 'name': prod.name or "",
+ 'note': pop.note or '',
+ 'use_time': 0,
+ 'max_use_time': pop.max_use_time,
+ 'dialyzer_type': pop.dialyzer_type,
+ 'exp_date': pop.exp_date,
+ 'department_id': obj.department_id.id,
+ 'patient_id': obj.patient_id.id,
+ 'visit_id': obj.visit_id.id,
+ }
+ else:
+ dlz_vals=get_model("clinic.dialyzer").default_get()
+ dlz_vals['patient_id']=obj.patient_id.id
+ dlz_vals['company_id']=dlz_vals['company_id'][0]
+ product_name=dlz_vals['product_id'][1]
+ dlz_vals['product_id']=dlz_vals['product_id'][0]
+
dlz_id=get_model('clinic.dialyzer').create(dlz_vals)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
dialyzer.confirm()
diff --git a/netforce_clinic/models/hd_case_popup_dlz.py b/netforce_clinic/models/hd_case_popup_dlz.py
index 2ea1132..25cca42 100644
--- a/netforce_clinic/models/hd_case_popup_dlz.py
+++ b/netforce_clinic/models/hd_case_popup_dlz.py
@@ -22,6 +22,16 @@ class HDCasePopupDlz(Model):
_defaults={
'hd_case_id': _get_hd_case_id,
+ 'dialyzer_type': 'low',
+ 'max_use_time': 10,
}
+
+ def new_dlz(self,ids,context={}):
+ obj=self.browse(ids)[0]
+ hd_case=obj.hd_case_id
+ if hd_case:
+ context['is_wiz']=True
+ context['pop_id']=obj.id
+ return hd_case.new_dialyzer(context=context)
HDCasePopupDlz.register()
diff --git a/netforce_clinic/models/patient_cycle.py b/netforce_clinic/models/patient_cycle.py
index 4a964e9..38378d7 100644
--- a/netforce_clinic/models/patient_cycle.py
+++ b/netforce_clinic/models/patient_cycle.py
@@ -8,6 +8,7 @@ class PatientCycle(Model):
_fields={
"patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True),
"cycle_id": fields.Many2One('clinic.cycle',"Cycle",search=True),
+ "department_id": fields.Many2One('clinic.department',"Department",search=True),
'day': fields.Selection([('mon', 'Monday'), ('tue','Tuesday'), ('wed','Wedsday'),('thu','Thursday'),('fri','Friday'),('sat','Satherday'),('sun','Sunday')], 'Days',search=True),
}
diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py
index f6edb6d..0fda6ff 100644
--- a/netforce_clinic/models/visit.py
+++ b/netforce_clinic/models/visit.py
@@ -120,6 +120,7 @@ class Visit(Model):
patient=obj.patient_id
dialyzers=get_model("clinic.dialyzer").search_browse([['patient_id','=',patient.id],['state','=','active']])
if not dialyzers:
+ return {} ### for to new dlz from hd case
dlz_id=self.new_dlz(patient.id, obj.department_id.id)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
else:
@@ -176,7 +177,8 @@ class Visit(Model):
st=get_model("clinic.setting").browse(1)
if st.find_dlz:
dialyzer=self.get_dlz(obj.id)
- vals['dialyzers'].append(('create',dialyzer))
+ if dialyzer:
+ vals['dialyzers'].append(('create',dialyzer))
vals['staffs'].append(('create',{
'staff_id': obj.doctor_id.id,