conv_bal
watcha.h 2014-10-23 12:24:25 +07:00
parent 2dd2b4cfcc
commit 14b7a67e92
4 changed files with 29 additions and 26 deletions

View File

@ -3,7 +3,6 @@
<field name="state"/>
<button string="Options" dropdown="1">
<item string="Get Dialyzer" action="clinic_get_dlz"/>
<!--<item string="Print Payment" method="print_payment"/>-->
</button>
</head>
<group span="6" columns="1">
@ -100,7 +99,7 @@
<button string="Done" type="success" icon="ok" method="done" states="in_progress"/>
<!--<button string="Complete" type="success" icon="ok" method="complete" states="in_progress"/>-->
<button string="Discontinue" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
<button string="Undo" type="default" icon="refresh" method="undo" states="completed"/>
<button string="Undo" type="default" icon="repeat" method="undo" states="completed"/>
<button string="Pay" type="success" icon="ok" action="clinic_payment" states="waiting_payment" />
</foot>
<related>
@ -120,8 +119,8 @@
<field name="state"/>
</list>
</field>
<field name="pickings" click_action="view_picking"/>
<field name="payments" click_action="clinic_view_payment"/>
<field name="pickings" click_action="view_picking"/>
<field name="comments"/>
</related>
</form>

View File

@ -249,13 +249,13 @@ class HDCase(Model):
payment_id=get_model("account.payment").create(vals,context={"type":"in"})
obj.write({
#'pay_amount': remaining_amt-obj.pay_amount,
#'pay_amount': 0, # reset
'payment_lines': [('create',{
'payment_id': payment_id,
'amount': pay_amount,
})],
})
payment=get_model('account.payment').browse(payment_id)
payment.post()
return {
'next': {
'name': 'clinic_hd_case',
@ -453,9 +453,11 @@ class HDCase(Model):
for obj in self.browse(ids):
for dlz_line in obj.dialyzers:
dlz=dlz_line.dialyzer_id
dlz.write({
'use_time': dlz_line.use_time,
})
#XXX
if dlz_line.use_time > dlz.use_time:
dlz.write({
'use_time': dlz_line.use_time,
})
return True
def complete(self,ids,context={}):
@ -573,6 +575,7 @@ class HDCase(Model):
def done(self,ids,context={}):
obj=self.browse(ids)[0]
obj.update_usetime()
obj.write({
'state': 'waiting_payment',
})

View File

@ -9,7 +9,7 @@ class HDCasePayment(Model):
"pay_amount": fields.Float("Due Amount"),
"fee": fields.Float("Fee"),
"to_pay": fields.Float("To Pay"),
"complete": fields.Boolean("Complete"),
"complete": fields.Boolean("Mark as full payment for Cash"),
}
def _get_hd_case_id(self,context={}):
@ -43,43 +43,45 @@ class HDCasePayment(Model):
def cash(self,ids,context):
obj=self.browse(ids)[0]
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
context['amount']=obj.pay_amount or 0.0
context['make_invoice']=False
hd_case.make_invoices(context=context) #XXX
hd_case.post_invoices()
if obj.pay_amount:
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
context['amount']=obj.pay_amount or 0.0
context['make_invoice']=False
hd_case.make_invoices(context=context) #XXX
hd_case.make_payment(context=context)
if obj.complete:
hd_case.write({
'state': 'completed',
})
obj.write({
'pay_amount': hd_case.amount,
if obj.complete:
hd_case.write({
'state': 'completed',
})
obj.write({
'pay_amount': hd_case.amount,
})
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': hd_case.id,
},
'flash': 'Paid',
'flash': '%s has been paid'%hd_case.number,
}
def credit(self,ids,context):
obj=self.browse(ids)[0]
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
hd_case.make_invoices()
if obj.complete:
hd_case.write({
'state': 'completed',
})
hd_case.post_invoices()
#if obj.complete:
hd_case.write({
'state': 'completed',
})
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': hd_case.id,
},
'flash': 'Paid',
'flash': '%s has been paid'%hd_case.number,
}
def onchange_amount(self,context={}):

View File

@ -115,7 +115,6 @@ class Visit(Model):
'cycle_id' : obj.cycle_id.id,
'visit_id': obj.id,
'cycle_id': obj.cycle_id.id,
'fee_type': obj.patient_id.type,
'lines':[],
'dialyzers': [],
'state': 'draft',