diff --git a/netforce_clinic/actions/clinic_hd_case_distcont.xml b/netforce_clinic/actions/clinic_hd_case_distcont.xml
new file mode 100644
index 0000000..bbdf364
--- /dev/null
+++ b/netforce_clinic/actions/clinic_hd_case_distcont.xml
@@ -0,0 +1,6 @@
+
+ Reason
+ form_popup
+ clinic.hd.case.discont
+ _popup
+
diff --git a/netforce_clinic/layouts/clinic_hd_case_dist_form.xml b/netforce_clinic/layouts/clinic_hd_case_dist_form.xml
new file mode 100644
index 0000000..e71ce15
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_hd_case_dist_form.xml
@@ -0,0 +1,7 @@
+
diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 88cc5ad..603c73c 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -56,6 +56,7 @@
+
@@ -85,7 +86,8 @@
-
+
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index 17d127d..352a95e 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -9,6 +9,7 @@ from . import nurse
from . import visit
from . import hd_case
from . import hd_case_line
+from . import hd_case_discont
from . import dialyzer
from . import dialyzer_line
from . import department
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index e25b20d..e3a55a4 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -56,6 +56,7 @@ class HDcase(Model):
"time_stop": fields.DateTime("Time stop",required=True,search=True),
"date": fields.Date("Date Treatment",required=True),
'planes': fields.One2Many("clinic.visit.plane","hd_case_id","Planning"),
+ 'note': fields.Text("Note"),
}
def _get_number(self,context={}):
@@ -470,5 +471,6 @@ class HDcase(Model):
line['state']='open'
return data
+
HDcase.register()
diff --git a/netforce_clinic/models/hd_case_discont.py b/netforce_clinic/models/hd_case_discont.py
new file mode 100644
index 0000000..b746913
--- /dev/null
+++ b/netforce_clinic/models/hd_case_discont.py
@@ -0,0 +1,39 @@
+from netforce.model import Model, fields, get_model
+
+class HDCaseDiscont(Model):
+ _name="clinic.hd.case.discont"
+ _transient=True
+
+ _fields={
+ "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
+ "note": fields.Text("Description"),
+ }
+
+ def _get_hd_case_id(self,context={}):
+ hd_case_id=context.get("refer_id")
+ if not hd_case_id:
+ return None
+ return int(hd_case_id)
+
+ _defaults={
+ 'hd_case_id': _get_hd_case_id,
+ }
+
+ def do_discontinue(self,ids,context):
+ obj=self.browse(ids)[0]
+ hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
+ hd_case.write({
+ 'note': obj.note,
+ 'state': 'uncompleted',
+ })
+ return {
+ 'next': {
+ 'name': 'clinic_hd_case',
+ 'mode': 'form',
+ 'active_id': hd_case.id,
+ },
+ 'flash': '%s has been cancelled'%hd_case.number,
+ }
+
+HDCaseDiscont.register()
+