waiting approval option in hd case

conv_bal
watcha.h 2014-11-30 12:54:57 +07:00
parent 9f0c65072b
commit 30424aee4b
7 changed files with 99 additions and 50 deletions

View File

@ -108,17 +108,15 @@
</tab>
</tabs>
<foot>
<button string="Start" type="success" icon="arrow-right" method="do_treatment" states="draft"/>
<button string="Start" type="success" icon="arrow-right" method="do_treatment" states="draft,waiting_treatment"/>
<button string="Done" type="success" icon="ok" method="done" states="in_progress"/>
<button string="Discontinue" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
<button string="Pay" type="success" icon="ok" action="clinic_payment" states="waiting_payment" />
<button string="Approve" type="success" icon="ok" method="approve" states="waiting_approval" />
</foot>
<related>
<field name="invoices" click_action="view_invoice">
<list colors='{"#9f9":[["state","=","paid"]]}'>
<head>
<button string="Pay" type="success" icon="ok"/>
</head>
<field name="number"/>
<field name="ref"/>
<field name="inv_type"/>

View File

@ -1,4 +1,4 @@
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]]}'>
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]]}'>
<field name="number"/>
<field name="ref"/>
<field name="date"/>

View File

@ -1,42 +1,45 @@
<form model="clinic.setting" title="Clinic Settings">
<tabs>
<tab string="HD Case">
<separator string="Expenes"/>
<field name="products" nolabel="1">
<list>
<field name="patient_type"/>
<field name="type"/>
<field name="product_id" onchange="onchange_product"/>
<field name="description"/>
<field name="uom_id"/>
<field name="price" onchange="onchange_setting_line"/>
<field name="qty" onchange="onchange_setting_line"/>
<field name="amount"/>
</list>
<form>
<field name="patient_type"/>
<field name="type"/>
<field name="product_id"/>
<field name="description"/>
<field name="uom_id"/>
<field name="price"/>
<field name="qty"/>
<field name="amount"/>
</form>
</field>
<separator string="Invoice Policy"/>
<field name="invoice_policies" nolabel="1">
<list>
<field name="patient_type"/>
<field name="invoice_policy"/>
<field name="invoice_option"/>
</list>
<form>
<field name="patient_type"/>
<field name="invoice_policy"/>
<field name="invoice_option"/>
</form>
</field>
<group form_layout="stacked">
<field name="waiting_approval"/>
<separator string="Expenes"/>
<field name="products" nolabel="1">
<list>
<field name="patient_type"/>
<field name="type"/>
<field name="product_id" onchange="onchange_product"/>
<field name="description"/>
<field name="uom_id"/>
<field name="price" onchange="onchange_setting_line"/>
<field name="qty" onchange="onchange_setting_line"/>
<field name="amount"/>
</list>
<form>
<field name="patient_type"/>
<field name="type"/>
<field name="product_id"/>
<field name="description"/>
<field name="uom_id"/>
<field name="price"/>
<field name="qty"/>
<field name="amount"/>
</form>
</field>
<separator string="Invoice Policy"/>
<field name="invoice_policies" nolabel="1">
<list>
<field name="patient_type"/>
<field name="invoice_policy"/>
<field name="invoice_option"/>
</list>
<form>
<field name="patient_type"/>
<field name="invoice_policy"/>
<field name="invoice_option"/>
</form>
</field>
</group>
</tab>
<tab string="Labor Cost">
<separator string="Nurse"/>

View File

@ -502,9 +502,18 @@ class HDCase(Model):
def do_treatment(self,ids,context={}):
obj=self.browse(ids)[0]
#TODO should find dlz when confirm visit
if not obj.dialyzers:
raise Exception("Please input dialyzer!")
obj.write({"state":"in_progress"})
# update start time
timenow=time.strftime("%H:%M:%S")
date=obj.date
vals={
'time_start': '%s %s'%(date,timenow),
'time_stop': '%s %s'%(date,timenow),
'state': 'in_progress',
}
obj.write(vals)
def discontinue(self,ids,context={}):
obj=self.browse(ids)[0]
@ -549,9 +558,16 @@ class HDCase(Model):
obj.post_invoices()
obj.update_usetime()
obj.create_cycle_item()
obj.write({
timenow=time.strftime("%H:%M:%S")
date=obj.date
vals={
"state":"completed",
})
'time_stop': '%s %s'%(date,timenow),
}
st=get_model("clinic.setting").browse(1)
if st.waiting_approval:
vals['state']='waiting_approval'
obj.write(vals)
if context.get("called"):
return obj.id
return {
@ -846,5 +862,20 @@ class HDCase(Model):
data['mdc_amount']=mdc
data['amount']=due_amt
return data
def approve(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({
'state': 'completed',
})
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': obj.id,
},
'flash': '%s has been approval'%obj.number,
}
HDCase.register()

View File

@ -1,3 +1,5 @@
import time
from netforce.model import Model, fields, get_model
class HDCasePayment(Model):
@ -48,13 +50,20 @@ class HDCasePayment(Model):
context['make_invoice']=False
hd_case.make_invoices(context=context) #XXX
hd_case.post_invoices()
st=get_model("clinic.setting").browse(1)
if obj.pay_amount:
hd_case.make_payment(context=context)
if obj.complete:
hd_case.create_cycle_item()
hd_case.write({
date=hd_case.date
timenow=time.strftime("%H:%M:%S")
vals={
'time_stop': '%s %s'%(date,timenow),
'state': 'completed',
})
}
if st.waiting_approval:
vals['state']='waiting_approval'
hd_case.write(vals)
obj.write({
'pay_amount': hd_case.amount,
})
@ -73,10 +82,16 @@ class HDCasePayment(Model):
hd_case.make_invoices()
hd_case.post_invoices()
hd_case.create_cycle_item()
#if obj.complete:
hd_case.write({
st=get_model("clinic.setting").browse(1)
date=hd_case.date
timenow=time.strftime("%H:%M:%S")
vals={
'time_stop': '%s %s'%(date,timenow),
'state': 'completed',
})
}
if st.waiting_approval:
vals['state']='waiting_approval'
hd_case.write(vals)
return {
'next': {
'name': 'clinic_hd_case',

View File

@ -20,6 +20,7 @@ class ClinicSetting(Model):
'cost_per_case': fields.Float("Cost Per Case"),
'company_id': fields.Many2One("company", 'Company'),
'period_id': fields.Many2One("clinic.period","Period"),
'waiting_approval': fields.Boolean("Waiting Approval"),
}
_defaults={

View File

@ -1,3 +1,5 @@
improval
- type of patient
=====
import payment from government
- read file
@ -5,7 +7,6 @@
- uc
excel
- social security
======
bug:
มีปัญหาการสร้าง address ของ contact จากผู้ป่วยโดยอัตโนมัติ เพราะมันไม่ได้ถูกเก็บไว้ที่ form