diff --git a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml
index 83203c1..810ae6a 100644
--- a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml
@@ -6,6 +6,7 @@
+
diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 3dde598..6587a9b 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -56,6 +56,7 @@
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 16c7a99..2c9b7c3 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -1305,7 +1305,20 @@ class HDCase(Model):
}
def new_dialyzer(self,ids,context={}):
+ '''
+ drop old one and create new dlz
+ '''
obj=self.browse(ids)[0]
+ if context.get('drop_old'):
+ for dlz_line in obj.dialyzers:
+ dlz=dlz_line.dialyzer_id
+ dlz_line.write({
+ 'use_time': dlz.use_time,
+ })
+ dlz.write({
+ 'state': 'drop',
+ })
+
is_wiz=context.get("is_wiz")
dlz_vals={}
if is_wiz:
diff --git a/netforce_clinic/models/hd_case_dialyzer.py b/netforce_clinic/models/hd_case_dialyzer.py
index 7adfee1..e58fcf5 100644
--- a/netforce_clinic/models/hd_case_dialyzer.py
+++ b/netforce_clinic/models/hd_case_dialyzer.py
@@ -14,6 +14,13 @@ class HDCaseDialyzerLine(Model):
}
return res
+ def _get_dlz_state(self,ids,context={}):
+ res={}
+ for obj in self.browse(ids):
+ dlz=obj.dialyzer_id
+ res[obj.id]=dlz.state
+ return res
+
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HDCase",on_delete="cascade"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
@@ -25,6 +32,7 @@ class HDCaseDialyzerLine(Model):
'hdcase_date': fields.Date('Date', function="_get_all",function_multi=True),
"hdcase_state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True,function="_get_all",function_multi=True),
'nurse_id': fields.Many2One('clinic.staff', 'Nurse',function="_get_all",function_multi=True),
+ "state": fields.Selection([("new","New"),("active","Active"),("drop","Drop"),("expire","Expire"),('cancelled','Cancelled')],"Status",function="_get_dlz_state"),
}
_order="hd_case_id.date desc"
diff --git a/netforce_clinic/models/hd_case_popup_dlz.py b/netforce_clinic/models/hd_case_popup_dlz.py
index 74765c5..a4e9a41 100644
--- a/netforce_clinic/models/hd_case_popup_dlz.py
+++ b/netforce_clinic/models/hd_case_popup_dlz.py
@@ -12,6 +12,7 @@ class HDCasePopupDlz(Model):
"exp_date": fields.Date("Expiry Date"),
"note": fields.Text("Note"),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
+ 'drop_old': fields.Boolean("Drop Old Dialyzer"),
}
def __get_hd_case_id(self,context={}):
@@ -45,6 +46,7 @@ class HDCasePopupDlz(Model):
'membrane_type': membrane_type,
'max_use_time': max_use_time,
'product_id': product_id,
+ 'drop_old': True,
}
print('res', res)
return res
@@ -56,6 +58,7 @@ class HDCasePopupDlz(Model):
if hd_case:
context['is_wiz']=True
context['pop_id']=obj.id
+ context['drop_old']=obj.drop_old
res=hd_case.new_dialyzer(context=context)
print('res ', res)
return res