Posting GL Entries using Server Script

Since GL is not impacted in internal transfers by default.

Your related parties aren’t configured correctly. This absolutely happens in correctly configured intercompany transactions. You shouldn’t be creating GL entries without a source document. If you do the work to connect the handwritten GL entries, you’ll end reproducing the work that already exists for intercompany transactions.

My advice is to fix your process and remove your script.