Hi @mohamed
You could review the code of my module that do that features among others at:
https://github.com/aek/odoo_public/tree/8.0/addons/medical_invoice
Maybe you need to adapt to your medical customization, I just share the medical_invoice module and there will be some models that don't exist in that module so don't use as is.
The idea is that you invoice from Sale Orders and in the Create Invoice wizard there are some fields related to the co-payment method of invoice. The co-payment method means that if the Patient have an Insurance then you could create Invoices to the Patient and the Insurance by the following rules:
1- Invoice the Complete Sale Order with co-payment
2- Select the lines to Invoice with co-payment
In those 2 methods of invoice you will be able to select if:
- Invoice all the amount to the Insurance, that will create only one Invoice with the Insurance as Client
- Invoice an amount to the Insurance and the rest to the Patient, that will create 2 Invoices, one for the Insurance and one for the Patient with their respective amounts
For the Insurance Invoices there will be no Tax included in the generated Invoice lines. All the Invoices are generated with draft state, so you could customized latter
Please vote if you find it helpful
did you check this?