to draft invoice in hdcase
parent
43466e07f9
commit
2690a20b93
|
@ -136,6 +136,7 @@
|
|||
<head>
|
||||
<button string="Print" action="clinic_hdcase_invoice_print" action_options="convert=pdf" icon="print"/>
|
||||
<button string="Pay" method="pay_invoice" type="success"/>
|
||||
<button string="To Draft" method="hdcase_to_draft" type="default"/>
|
||||
</head>
|
||||
<field name="number"/>
|
||||
<field name="ref"/>
|
||||
|
|
|
@ -469,5 +469,15 @@ class AccountInvoice(Model):
|
|||
'flash': 'Invoice: %s has been paid'%(','.join(paid_inv)),
|
||||
}
|
||||
|
||||
def hdcase_to_draft(self, ids, context={}):
|
||||
for payment_line in get_model("account.payment.line").search_browse([['invoice_id','in',ids]]):
|
||||
payment=payment_line.payment_id
|
||||
rel=payment.related_id
|
||||
if rel._model=='clinic.hd.case':
|
||||
payment.to_draft()
|
||||
payment.delete()
|
||||
for inv in self.browse(ids):
|
||||
inv.to_draft()
|
||||
inv.approve()
|
||||
|
||||
AccountInvoice.register()
|
||||
|
|
Loading…
Reference in New Issue