Talk to your accountant to get guidance with your problem.
If you don't have one, it is advisable to employ one.
While accounting software indeed doesn't care, many tax authorities may.
A country tag would be helpful.
In many jurisdictions there are strict rules to follow when it comes to invoices.
Invoicing one company and getting money from another (non invoiced) company may raise red flags (potential suspicion of money laundering or off the books work / contracts) or be seen as a separate income, requiring a separate invoice for that company.
If the company sending the money is a parent or sister company there may be less issues but eyebrows most likely will be raised when your books are audited.