Error in posting with function

I am trying to create a function that will allow me to make a post of an invoice from the Cash Receipt Entry module.

The widget function I have is the following:

When testing it, it appears that if the invoice post is done, because the group disappears.

However, when I go to the AR Invoice Entry module to create an invoice, it shows me the amount of the order.

The invoice amount should show me at 0, due to the fact that payment was already made on a cash receipt.

The unexpected outcome of the invoice:

Do you have one you can do manually and get a complete trace? Might be missing a step or a field.
(obviously)

I don’t know enough about posting to say what’s wrong off the top of my head.

What do you mean by manually?

Do you want me to show you the process at the system level, or each of the steps that the function performs in detail?

I mean to do a trace while doing those same actions the function takes to get the expected result.

That one, so we can see if something is missing.

I attach the process trace in console:

I am going to perform the process at system level to show it.

1 Like