Synchronise stock

Just hit a snag

I had assumed (wrongly) that this would be straightforward. We are using ERPNEXT just for selling at the moment while we get used to it. So Quote > Sales Order > Invoice > Mark as paid

All of our accounting, purchasing and stock control is done externally

So having a quick look at import and stock reconciliation I had a assumed al I had to do was impor stock levels into ERPNEXT daily and all would be well

But no, there is a max number of line in the CSV file of 100

We have currently nearly 2000 products

We are using ERPNEXT cloud so limited in what we can do.

I wish to be able to upload stock levels from our stock control database, via CSV file into ERPNEXT ideally on a daily basis. Happy to do this manually at the end of the day, but not if I need to be break it down into 20 files!

Anyone any ideas how I can get around this?

The import does not need to worry about finances / valuations or anything else. Just to over wright the current stock balance

Does it need to be done through CSV? You could use the REST API and link it to your stock control database.

Hi Ben

No it does not need to be CSV. I just thought it was the most straightforward.
I would not have a clue about using REST API - is that possible with hosting on cloud?

It is possible - you’ll most likely need someone with some programming experience to implement it. If you can export your stock into a csv / excel file, you can pretty easily write an Excel VBA macro that will allow you to modify the stock of each item.

I haven’t done that specifically, but have successfully used the REST API and excel vba macros to modify and create items. Here is a sample Excel Macro that lets you log in to your ERP server and cancel, submit or delete groups of DocTypes. It’s pretty rough but it should give you an example of how to use REST.

ERPNext Mass Editing

Let me know if you need any further guidance.

1 Like

That is pretty interesting but I can see in the code a reference to a local html file at line 115, it fails as I don’t have this file but I managed to make it work by changing it’s path.

In UserForm_Initialize you are always pointing to localhost which I think is not right also but I may not be correct.

Regards and thank you for sharing this!

Right - there are a couple things that may cause problems:

  1. The linked html file. This is for debugging mostly (it generates an html file based on the response from the server). You can set that to generate wherever you’d like. It is probably crashing because my folder structure isn’t on your computer).
  2. The website should get updated to your ERP website. I think I was having an issue getting the website to work for the log in and editing (because of the way I structured the files) and just hard coded it for simplicity.