Issue with GL Entry Mismatch When Adding Subscription Plans in Sales Invoice

I’m facing an issue with Sales Invoice generation after integrating Subscription Plans into it.

The Sales Invoice in ERPNext is originally designed to handle item-based billing, but in our use case, we’ve added plans to display which subscription plan the customer has selected and its respective cost.

After adding a script to include the plan total along with the items total in the invoice, everything appears correct on the UI. However, during submission, the system throws an error due to a GL Entry mismatch.

ERPNext’s GL generation logic only creates entries for items, and since the plan total isn’t part of the standard item entries, it results in a Total Difference error during validation.

What I’ve Tried:

  • Created a custom server script to adjust GL entries — didn’t work, as ERPNext performs the difference check during submission.

  • Attempted to override the core GL generation logic through a custom app — became complex and unstable.