Webhooks in ERPNext

Hi @all
It seems that ERPNext v11 can’t sync to Shopify anymore unless we register webhook in ERPNext.
can anyone help me please, how to do this? or direct me to a documentation.

https://frappe.io/docs/user/en/guides/integration/webhooks

See if this can help

1 Like

Thanks @root13F
This doc is for creating webhooks in erpnext which fire events to external app, in this case shopify has to listen to this events.
what I want is; the revers. when an event occurs (creates order/customer) in shopify then Erpnext should listen to those events and create those order/customer in erpnext database.

is there any help for that on Shopify’s developer documentation ?

1 Like

I think Shopify recently added webhooks.
just four days ago on Jul 1 2018

there is a very clear doc

Mr. @root13F
one thing is really surprising me
why others do not have this problem which I have
others do not update to v11 or …

as far as I know v11 has not been released yet. and develop branch is not the stable branch.

do you face the same problem on master branch of erpnext and frappe.

1 Like

I installed it 2 weeks ago

Can I install a specific version of erpnext?

No as you see here

testing is still on. otherwise there would have been a big stickied post for v11

yes you can. checkout to master branch both in frappe and erpnext.

I should remove froppe-bench folder?
then git is not working, how do i switch to another branch
git is initiated in that folder

no need to remove frappe-bench folder

git is not initiated in frappe-bench or your bench instance folder but in the apps that you get i.e. erpnext, frappe, shopify etc.

you can try bench switch-to-branch master command

it will switch all apps branches to master.

1 Like

it pops this error

bench@MMERP1:~/erpnext/apps/erpnext$ bench switch-to-branch master
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/opt/bench/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/bench-repo/bench/commands/update.py", line 126, in switch_to_branch
    switch_to_branch(branch=branch, apps=list(apps), upgrade=upgrade)
  File "/opt/bench/bench-repo/bench/app.py", line 400, in switch_to_branch
    switch_branch(branch, apps=apps, bench_path=bench_path, upgrade=upgrade)
  File "/opt/bench/bench-repo/bench/app.py", line 358, in switch_branch
    apps = [name for name in os.listdir(apps_dir)
OSError: [Errno 2] No such file or directory: './apps'

instead of froppe-bench folder I have erpnext

then erpnext and frappe folders are inside apps folder

I get same error when i run bench switch-to-branch master inside frappe folder

if you want to switch branches individually then you go to each app and change branch like this

git checkout master

or if you wish to use bench switch-to-branch master

then you know that you run bench commands in frappe-bench folder not in apps folder.

now I’m in branch *master but this is local not remote I think
11

did you migrate and check if it is running ?

check the version after starting bench

1 Like

still I’m at v11, I’m checking in the front-end not using bench, how to check version using bench command?

do one thing. checkout back to develop in erpnext.

delete the master branch you created via this command

git branch -D master

then run

git fetch upstream

after completion

check if you can see master in the output that it throws after completion

1 Like

sorry I made a mistake

when i run bench switch-to-master i get this

bench@mmerp:~/erpnext$ bench switch-to-master
Switching for frappe
INFO:bench.utils:git config --unset-all remote.upstream.fetch
INFO:bench.utils:git config --add remote.upstream.fetch '+refs/heads/*:refs/remo                                     tes/upstream/*'
INFO:bench.utils:git fetch upstream
INFO:bench.utils:git checkout master
Already on 'master'
Your branch is up to date with 'upstream/master'.
INFO:bench.utils:git merge upstream/master
Already up to date.
Branch master does not exist in Upstream for erpnext
Successfully switched branches for:
frappe
()
Switched to master
Please run `bench update --patch` to be safe from any differences in database schema

then I run bench update --patch i got this error

bench@mmerp:~/erpnext$ bench update --patch
Backing up sites...
Patching sites...
Migrating erp.nawrooz.com
Updating DocTypes for frappe        : [                                        ]Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module>
    main()
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/opt/bench/erpnext/apps/frappe/frappe/migrate.py", line 33, in migrate
    frappe.model.sync.sync_all(verbose=verbose)
  File "/opt/bench/erpnext/apps/frappe/frappe/model/sync.py", line 19, in sync_all
    sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
  File "/opt/bench/erpnext/apps/frappe/frappe/model/sync.py", line 45, in sync_for
    reset_permissions=reset_permissions, for_sync=True)
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/import_file.py", line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/import_file.py", line 132, in import_doc
    doc.insert()
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 233, in insert
    self.db_insert()
  File "/opt/bench/erpnext/apps/frappe/frappe/model/base_document.py", line 303, in db_insert
    ), list(d.values()))
  File "/opt/bench/erpnext/apps/frappe/frappe/database.py", line 166, in sql
    self._cursor.execute(query, values)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 516, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 727, in _read_query_result
    result.read()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1066, in read
    first_packet = self.connection._read_packet()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
    packet.check_error()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1048, u"Column 'track_views' cannot be null")

and now erp is not loading in the browser