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.

Am facing similar issue on Stock Entry - Material Transfer. It gets submitted for second or two and then system reverts back to Draft mode. When I try to transfer Item using Move button on Item page I get Could not find Voucher No: error. By mistake I had enable core WooCommerce app instead on @lasalesi app. I have removed the tick on Enable button however there is no way of deleting the configuration.

Am on

ERPNext:v12.22.0 (version-12)
Frappe Framework:  v12.19.2 (version-12)

Have done everything from bench build, update --reset and clear-cache. No luck

This can indeed be caused by the WooCommerce integration. The connection in WooCommerce Connector is designed to update changed quantities automatically to WooCommerce, so any document affecting tabBinwill trigger a WooCommerce update. If this fails, the save/submit is blocked.

Shortterm: disable stock updates or WooCommerce Connector. Longterm solution: troubleshoot why the connection does not work. The Log will give you clues on this…

Hope this helps.

Fixed it. Did this
Disabled core and connector
Made the WooCommerce ID readable
Copied all items that had WooCommerce ID on WordPress site
Made WooCommerce ID non readble.
Enabled sync. And it worked

1 Like

Else just uploaded a file through data entry with ERPNext item code and WooCommerce ID. This is faster and does not need to go through the above steps. Did it for more than 150 items. Took about couple of minutes.