Pos sync issue when closing invoice

hi
i have set event streaming to sync two servers together,
when I close pos and create an invoice get automatic the system sends the pos submitted so the system creates an invoice automatically.
also, it receive the invoice from the server, now I have two invoices.

i added a condition that not sync an is_consolidated so I skipped the issue of duplication

now the closing pos synced and it automatically creates a sales invoice. but with different names!

i was thinking of a fix in a custom app. but I think this should go to erpnext somehow