Try ERPNext Buy Support Partners Foundation

Purchase Invoice is submitted, but remains draft

I am testing the Woocommerce connector and came accross a weird problem.

What happened: Sales order came in from Woocommerce.

After going through the purchase cycle, I cannot submit purchase invoice.
When I submit a purchase invoice (from a purchase order), I can print it and send it.
Also the ledger is updated.

However, after reloading the page, it goes back to Draft again (no error what so ever).

Also the purchase order status is still “To be Billed”. When I submit the purchase invoice again, same story, however, the amount in the ledger is added up as often as I repeat the procedure.

Same story when submitting Purchase Receipt.

It turns out that the sync to Woocommerce fails after submitting the purchase invoice.
(some IDs cannot be synced).

However, the GL-Entry is created too early, that’s the real problem. So the document status is reverted (without any explanation though), but accounting is messed up.

It seems that the GL_Entry should be reverted after sync failed…

If someone could have a look at it, I have environment to reproduce this behavior.

This behavior seems to be due to a bug in the woocommerce integration.

When woocommerce sync fails, the invoice is reverted to “Draft”. However, there is already a GL_Entry that is not being reverted.

Seems the sync check needs to be put before the GL_Entry.