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"/> <field name="state"/>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="Get Dialyzer" action="clinic_get_dlz"/> <item string="Get Dialyzer" action="clinic_get_dlz"/>
<!--<item string="Print Payment" method="print_payment"/>-->
</button> </button>
</head> </head>
<group span="6" columns="1"> <group span="6" columns="1">
@ -100,7 +99,7 @@
<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="Complete" type="success" icon="ok" method="complete" 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="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" /> <button string="Pay" type="success" icon="ok" action="clinic_payment" states="waiting_payment" />
</foot> </foot>
<related> <related>
@ -120,8 +119,8 @@
<field name="state"/> <field name="state"/>
</list> </list>
</field> </field>
<field name="pickings" click_action="view_picking"/>
<field name="payments" click_action="clinic_view_payment"/> <field name="payments" click_action="clinic_view_payment"/>
<field name="pickings" click_action="view_picking"/>
<field name="comments"/> <field name="comments"/>
</related> </related>
</form> </form>

View File

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

View File

@ -9,7 +9,7 @@ class HDCasePayment(Model):
"pay_amount": fields.Float("Due Amount"), "pay_amount": fields.Float("Due Amount"),
"fee": fields.Float("Fee"), "fee": fields.Float("Fee"),
"to_pay": fields.Float("To Pay"), "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={}): def _get_hd_case_id(self,context={}):
@ -43,43 +43,45 @@ class HDCasePayment(Model):
def cash(self,ids,context): def cash(self,ids,context):
obj=self.browse(ids)[0] 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: 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) hd_case.make_payment(context=context)
if obj.complete: if obj.complete:
hd_case.write({ hd_case.write({
'state': 'completed', 'state': 'completed',
})
obj.write({
'pay_amount': hd_case.amount,
}) })
obj.write({
'pay_amount': hd_case.amount,
})
return { return {
'next': { 'next': {
'name': 'clinic_hd_case', 'name': 'clinic_hd_case',
'mode': 'form', 'mode': 'form',
'active_id': hd_case.id, 'active_id': hd_case.id,
}, },
'flash': 'Paid', 'flash': '%s has been paid'%hd_case.number,
} }
def credit(self,ids,context): def credit(self,ids,context):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id) hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
hd_case.make_invoices() hd_case.make_invoices()
if obj.complete: hd_case.post_invoices()
hd_case.write({ #if obj.complete:
'state': 'completed', hd_case.write({
}) 'state': 'completed',
})
return { return {
'next': { 'next': {
'name': 'clinic_hd_case', 'name': 'clinic_hd_case',
'mode': 'form', 'mode': 'form',
'active_id': hd_case.id, 'active_id': hd_case.id,
}, },
'flash': 'Paid', 'flash': '%s has been paid'%hd_case.number,
} }
def onchange_amount(self,context={}): def onchange_amount(self,context={}):

View File

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