libracore / WooCommerceConnector

Integration App for ERPNext to connect to WooCommerce
Other
81 stars 136 forks source link

Sync Order not synching actual date of the order. #50

Closed thomasoceguera closed 3 years ago

thomasoceguera commented 3 years ago

First off! Great tool! Thanks for making this happen.

I have synching working one way from WC with 5 different items including two variations.
I have a few things that would be great to fix but my main issue is that when the order syncs, it creates new orders using the date of the sync, instead of the actual order date. Normally, if everything was always working as it should this wouldn't be a problem. However, imagine a scenario where the synch is turned off for some reason and then turned back on. All new orders would be then synched according to the date and time of the sync, instead of the actual order date. This creates an issue if the order needs to be adjusted in ERPN.

My situation is like that. We charge in USD on Woo but our company currency in ERPN is THB. So every SO date needs to match the date of the payment entry because of currency exchange rates. As I said, normally, if everything works out fine and is syncing accurately every hour, the sales orders are created and submitted correctly. Then, when I make the payment entry manually (I can't seem to have them generated automatically) I just choose the date of the SO as the payment date and it works out fine.

But let's say I made a mistake with the flow of the SO and I need to delete the order and then resynch. Then I'm screwed because the SO date will be a different date and Exchange rate than the actual payment.

So my request would be to either allow the SO s to be created "as a draft" in the Config options or that the SO creation date is synced to the actual date of the sale in Woo. Either one will allow for fixing issues if an order needs to be resynched.

Cheers

lasalesi commented 3 years ago

Thanks for your feedback. I do agree that in a scenario where the sync was off or initial sync, the posting date should also be considered.

I have added this feature, please check out https://github.com/libracore/WooCommerceConnector/commit/3ef7ca5fd99c0eccd9157193860dfd9976b55e6f

The leading date will be the creation date (in case someone starts the order and only completes it a day later (e.g. over midnight), it will take this (as in rare cases it could be that completion_date in WC is missing)...