diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 17d8705..42e9eed 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -136,6 +136,7 @@
+
diff --git a/netforce_clinic/models/account_invoice.py b/netforce_clinic/models/account_invoice.py
index db919f5..c5200d0 100644
--- a/netforce_clinic/models/account_invoice.py
+++ b/netforce_clinic/models/account_invoice.py
@@ -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()