Using Odoo 10. I have an odoo DB with 3 company's, buth system is not configured as multicompany. We add some custom modules that add features so you can select a company in the invoice view the company used for that invoice.
Create a sequential number for each company in odoo.
This sequential number will be visible in the company configuration view.
The sequential number will increase eacth time a invoice for that company is done.
Add the sequential number to the invoice.
This sequential number will be used internally in system, will not be used for standard odoo invoice numbers.
Increment sequential number when function "to_json" is executed (cdfi_invoice_muti_rfc/models/account_invoice.py)
In the company view the sequential number will have the next number to assign to invoice.
In the invoice view will have the sequential number assigned to that invoice.
Make changes in cdfi_invoice_muti_rfc module