improve hd

conv_bal
watcha.h 2014-12-05 09:31:48 +07:00
parent 5ec01dc64a
commit 2076d92d22
4 changed files with 36 additions and 19 deletions

View File

@ -16,6 +16,7 @@
<field name="fee_partner_id" span="2" domain="[['type','=','org']]"/>
<field name="patient_type" span="2"/>
<field name="cycle_item_id" span="2"/>
<field name="req_fee" span="2" readonly="1" invisible="1"/>
</group>
<tabs>
<tab string="General">
@ -106,16 +107,13 @@
<tab string="Note">
<field name="note" nolabel="1"/>
</tab>
<tab string="Complication">
<field name="complication" nolabel="1"/>
</tab>
</tabs>
<foot>
<button string="Do Treatment" 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="Pay" type="success" icon="ok" method="pay" states="completed" />
<button string="Request Fee" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible": [["req_fee","=",0]]}'/>
<button string="Pay" type="success" icon="ok" method="pay" states="completed" attrs='{"invisible": [["req_fee","=",1]]}'/>
</foot>
<related>
<field name="invoices" click_action="view_invoice">

View File

@ -120,6 +120,7 @@ class HDCase(Model):
'nu': fields.Char("N/U"),
"invoice_policy": fields.Selection([("fee","Only Fee"),("fee_mdc","Fee & Medicine")],"Government pay for:"),
"invoice_option": fields.Selection([("fee_mdc_plus","Combine Fee & Medicine"),("fee_mdc_split","Split Fee & Medicine")],"Invoice:"),
'req_fee': fields.Integer("Request Expense"),
}
def _get_number(self,context={}):
@ -151,6 +152,7 @@ class HDCase(Model):
'fee_paid': False,
'invoice_option': 'fee',
'invoice_policy': 'fee',
'req_fee': 0,
}
_order="date desc,number desc"
@ -377,6 +379,10 @@ class HDCase(Model):
if not uom:
raise Exception("Unit not found in uom")
obj=self.browse(ids[0])
if obj.invoices:
for inv in obj.invoices:
inv.void()
due_date=obj.date[0:10] # XXX
# cash, credit
make_invoice=context.get('make_invoice',True)
@ -737,13 +743,21 @@ class HDCase(Model):
},
}
def pay(self,ids,context={}):
def request_fee(self,ids,context={}):
obj=self.browse(ids)[0]
if not obj.amount:
obj.update_usetime()
if not obj.amount:
#if not obj.amount:
obj.complete()
else:
# send some message to anyboby: patient
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': obj.id,
}
}
def pay(self,ids,context={}):
return {
'next': {
'name': 'clinic_payment',
@ -933,6 +947,10 @@ class HDCase(Model):
# when change patient
#vals=self.get_staff_fee(vals,patient_id)
vals=self.get_invoice_policy(vals,patient_id)
# if not other expense request fee
obj=self.browse(ids)[0]
if not obj.amount:
vals['req_fee']=1
super().write(ids,vals,**kw)
def approve(self,ids,context={}):

View File

@ -161,8 +161,8 @@ class ImportPayment(Model):
return ''.join(h for h in hn if h.isdigit())
def import_payment_pks(self,ids,context={}):
fmt='%Y-%m-%d %H:%M:%S'
start_time=time.strftime(fmt)
#fmt='%Y-%m-%d %H:%M:%S'
#start_time=time.strftime(fmt)
obj=self.browse(ids)[0]
fname=obj.file
fpath=get_file_path(fname)

View File

@ -2,7 +2,8 @@
- matching
- report expense
-- cost nurse / doctor
-XXXX
- reqeust fee again after request
- missing
- import schedule -> wait K. Ekk