confirm visit -> hd case
parent
fb9633027f
commit
d4d79da4ca
|
@ -9,6 +9,7 @@
|
|||
<field name="number"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_stop"/>
|
||||
<field name="visit_id"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<field name="patient_id" onchange="onchange_patient"/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form model="clinic.visit">
|
||||
<form model="clinic.visit" attrs='{"readonly":[["state","in",["cancelled","confirmed"]]]}' show_company="1">
|
||||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Print" icon="print" action="print_visit"/>
|
||||
|
@ -8,18 +8,23 @@
|
|||
</head>
|
||||
<tabs>
|
||||
<tab string="Visit">
|
||||
<group span="6" columns="1">
|
||||
<field name="number"/>
|
||||
<field name="department_id"/>
|
||||
<field name="visit_date"/>
|
||||
<field name="cycle"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<field name="department_id"/>
|
||||
<field name="patient_id" onchange="onchange_patient"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="nurse_id"/>
|
||||
</group>
|
||||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
<button string="Confirm" type="success" method="confirm" states="pending" />
|
||||
<button string="Cancel" type="danger" method="cancel" confirm="Are you sure to cancel HD case?"/>
|
||||
<button string="Reopen" type="default" method="reopen" states="cancelled" />
|
||||
<button string="Cancel" type="danger" method="cancel" states="confirmed" confirm="Are you sure to cancel HD case?"/>
|
||||
</foot>
|
||||
<related>
|
||||
<field name="comments"/>
|
||||
|
|
|
@ -37,6 +37,7 @@ class HDcase(Model):
|
|||
"invoices": fields.One2Many("account.invoice","related_id","Invoices"),
|
||||
"pickings": fields.One2Many("stock.picking","related_id","Pickings"),
|
||||
"payments": fields.One2Many("account.payment","related_id","Payments"),
|
||||
'visit_id': fields.Many2One("clinic.visit", "Visit"),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import time
|
||||
import datetime
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company, get_active_user
|
||||
|
@ -53,12 +54,42 @@ class Visit(Model):
|
|||
|
||||
def confirm(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
hd_case_obj=get_model("clinic.hd.case")
|
||||
dt=datetime.datetime
|
||||
fmt_date="%Y-%m-%d %H:%M:%S"
|
||||
timenow=dt.now().strftime("%H:%M:%S")
|
||||
date_from=dt.strptime("%s %s"%(obj.visit_date,timenow),fmt_date)
|
||||
to=3600
|
||||
date_to=date_from+datetime.timedelta(seconds=to)
|
||||
date_to=date_to.strftime(fmt_date)
|
||||
date_from=date_from.strftime(fmt_date)
|
||||
hd_case_id=hd_case_obj.create({
|
||||
'patient_id': obj.patient_id.id,
|
||||
'doctor_id': obj.doctor_id.id,
|
||||
'nurse_id': obj.nurse_id.id,
|
||||
'department_id': obj.department_id.id,
|
||||
'date_start': date_from,
|
||||
'date_stop': date_to,
|
||||
'visit_id': obj.id,
|
||||
})
|
||||
obj.write({"state":"confirmed"})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_hd_case',
|
||||
'mode': 'form',
|
||||
'active_id': hd_case_id,
|
||||
},
|
||||
'flash': 'Visit %s confirmed'%obj.number,
|
||||
}
|
||||
|
||||
def cancel(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({"state":"cancelled"})
|
||||
|
||||
def reopen(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({"state":"pending"})
|
||||
|
||||
def onchange_patient(self,context={}):
|
||||
data=context['data']
|
||||
patient_id=data['patient_id']
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
sequence (support multi company)
|
||||
sequence (support multi company) -> ok
|
||||
- visit
|
||||
- hd case
|
||||
- doctor
|
||||
- nurse
|
||||
- patient
|
||||
create new hd case after confirm visit
|
||||
question?
|
||||
- how cycle running?
|
||||
- treatment
|
||||
- 1 cycle take how long ?
|
||||
|
||||
|
|
Loading…
Reference in New Issue