cancel treament
parent
609dfb8a47
commit
ff83a1a41b
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="string">Reason</field>
|
||||
<field name="view_cls">form_popup</field>
|
||||
<field name="model">clinic.hd.case.discont</field>
|
||||
<field name="target">_popup</field>
|
||||
</action>
|
|
@ -0,0 +1,7 @@
|
|||
<form model="clinic.hd.case.discont">
|
||||
<field name="hd_case_id" invisible="1"/>
|
||||
<field name="note" nolabel="1" width="550" height="200"/>
|
||||
<foot>
|
||||
<button string="OK" type="success" method="do_discontinue"/>
|
||||
</foot>
|
||||
</form>
|
|
@ -56,6 +56,7 @@
|
|||
</field>
|
||||
</tab>
|
||||
<tab string="Others">
|
||||
<field name="note"/>
|
||||
<separator string="Accounting"/>
|
||||
<field name="paid" readonly="1"/>
|
||||
</tab>
|
||||
|
@ -85,7 +86,8 @@
|
|||
<foot>
|
||||
<button string="Confirm" type="success" method="confirm" states="draft"/>
|
||||
<button string="Complete" type="success" method="complete" states="in_progress"/>
|
||||
<button string="Discontinue" type="danger" method="discontinue" states="in_progress"/>
|
||||
<!--<button string="Discontinue" type="danger" method="discontinue" states="in_progress"/>-->
|
||||
<button string="Discontinue" type="danger" action="clinic_hd_case_distcont" states="in_progress"/>
|
||||
</foot>
|
||||
<related>
|
||||
<field name="invoices" click_action="view_invoice"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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={}):
|
||||
|
@ -471,4 +472,5 @@ class HDcase(Model):
|
|||
|
||||
return data
|
||||
|
||||
|
||||
HDcase.register()
|
||||
|
|
|
@ -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()
|
||||
|
Loading…
Reference in New Issue