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> </tab>
</tabs> </tabs>
<foot> <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="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="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="Pay" type="success" icon="ok" action="clinic_payment" states="waiting_payment" />
<button string="Approve" type="success" icon="ok" method="approve" states="waiting_approval" />
</foot> </foot>
<related> <related>
<field name="invoices" click_action="view_invoice"> <field name="invoices" click_action="view_invoice">
<list colors='{"#9f9":[["state","=","paid"]]}'> <list colors='{"#9f9":[["state","=","paid"]]}'>
<head>
<button string="Pay" type="success" icon="ok"/>
</head>
<field name="number"/> <field name="number"/>
<field name="ref"/> <field name="ref"/>
<field name="inv_type"/> <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="number"/>
<field name="ref"/> <field name="ref"/>
<field name="date"/> <field name="date"/>

View File

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

View File

@ -502,9 +502,18 @@ class HDCase(Model):
def do_treatment(self,ids,context={}): def do_treatment(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
#TODO should find dlz when confirm visit
if not obj.dialyzers: if not obj.dialyzers:
raise Exception("Please input dialyzer!") 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={}): def discontinue(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
@ -549,9 +558,16 @@ class HDCase(Model):
obj.post_invoices() obj.post_invoices()
obj.update_usetime() obj.update_usetime()
obj.create_cycle_item() obj.create_cycle_item()
obj.write({ timenow=time.strftime("%H:%M:%S")
date=obj.date
vals={
"state":"completed", "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"): if context.get("called"):
return obj.id return obj.id
return { return {
@ -846,5 +862,20 @@ class HDCase(Model):
data['mdc_amount']=mdc data['mdc_amount']=mdc
data['amount']=due_amt data['amount']=due_amt
return data 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() HDCase.register()

View File

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

View File

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

View File

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