cancel treament

conv_bal
watcha.h 2014-10-05 16:43:28 +07:00
parent 609dfb8a47
commit ff83a1a41b
6 changed files with 58 additions and 1 deletions

View File

@ -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>

View File

@ -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>

View File

@ -56,6 +56,7 @@
</field> </field>
</tab> </tab>
<tab string="Others"> <tab string="Others">
<field name="note"/>
<separator string="Accounting"/> <separator string="Accounting"/>
<field name="paid" readonly="1"/> <field name="paid" readonly="1"/>
</tab> </tab>
@ -85,7 +86,8 @@
<foot> <foot>
<button string="Confirm" type="success" method="confirm" states="draft"/> <button string="Confirm" type="success" method="confirm" states="draft"/>
<button string="Complete" type="success" method="complete" states="in_progress"/> <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> </foot>
<related> <related>
<field name="invoices" click_action="view_invoice"/> <field name="invoices" click_action="view_invoice"/>

View File

@ -9,6 +9,7 @@ from . import nurse
from . import visit from . import visit
from . import hd_case from . import hd_case
from . import hd_case_line from . import hd_case_line
from . import hd_case_discont
from . import dialyzer from . import dialyzer
from . import dialyzer_line from . import dialyzer_line
from . import department from . import department

View File

@ -56,6 +56,7 @@ class HDcase(Model):
"time_stop": fields.DateTime("Time stop",required=True,search=True), "time_stop": fields.DateTime("Time stop",required=True,search=True),
"date": fields.Date("Date Treatment",required=True), "date": fields.Date("Date Treatment",required=True),
'planes': fields.One2Many("clinic.visit.plane","hd_case_id","Planning"), 'planes': fields.One2Many("clinic.visit.plane","hd_case_id","Planning"),
'note': fields.Text("Note"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -471,4 +472,5 @@ class HDcase(Model):
return data return data
HDcase.register() HDcase.register()

View File

@ -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()