Cannot delete or cancel because Sales Invoice SINV-00004 is linked with Sales Invoice SINV-00004

Hello i have been testing trying to get recurring invoices working, and have setup some drafts however i would like to delete them now but get an error like you see in the subject line.

Not sure why but i should be able to delete sales invoices in draft state? something to do with recurring maybe?

Th invoice mostly is not in draft, you canceled the invoice and amended it or canceled it and made new amendment and returned to edit the older version…

Cancel all filters and refresh and see what you have…

I have canceled all filters did a refresh everything looks the same invoice is still in draft, but cannot be deleted.

At present, there is no option to delete Invoice that is in Draft mode. There is Request on github-ERPNext but unsure, when it will be made available.

That does not seem correct as i can and have created invoice drafts, and then deleted them in fact i just tested deleting a draft invoice just now.

@yashodhan That is wrong, all documents can be deleted what ever the status is unless its linked to another document…

@c0mputerking clear your server cache

Pushed a fix [fix] Ignore current document while checking linked docs on deletion by nabinhait · Pull Request #1691 · frappe/frappe · GitHub. Will be released later today.

1 Like

@ramielian @c0mputerking can you explain to me, why there is fix released then? :smirk:

@yashodhan why its not happening to our copies? not each installation is the same, it depends on many factors like system and server and the person installing it… and the most important one is internet speed and stability…

:grin:
Well, it would have been better if you would have realised that earlier when replying to my comment.

@yashodhan sorry for answering your comments, will not do it again :slight_smile:

1 Like

Not sure why my thread got closed as i have done a bench update just now and still CANNOT delete my Invoice … below is the output from the update i just did.

I would like to confirm i am on the stable version of ERPNext? as i see develop and hotfix? i want to be on the stable version and should probably repeat that the update i did today did not fix my inability to delete that my draft invoice.

root@erp-2:/# bench update
remote: Counting objects: 111, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 111 (delta 68), reused 68 (delta 68), pack-reused 14
Receiving objects: 100% (111/111), 35.37 KiB | 0 bytes/s, done.
Resolving deltas: 100% (68/68), completed with 49 local objects.
From https://github.com/frappe/frappe
   cb44325..ae0afc7  develop    -> upstream/develop
   f5bc120..5df5c71  hotfix     -> upstream/hotfix
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling paypal_integration
From https://github.com/frappe/paypal_integration
 * branch            master     -> FETCH_HEAD
Already up-to-date.
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subje
ct Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more info
rmation, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. T
his prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#inse
cureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
Migrating erp-2.solar.computerking.ca
Updating frappe                     : [========================================]
Updating erpnext                    : [========================================]
Updating paypal_integration         : [========================================]
Wrote ./assets/js/print_format_v3.min.js - 18k
Wrote ./assets/js/frappe-web.min.js - 101k
Wrote ./assets/js/form.min.js - 111k
Wrote ./assets/js/report.min.js - 157k
Wrote ./assets/js/erpnext.min.js - 35k
Wrote ./assets/css/list.min.css - 6k
Wrote ./assets/js/erpnext-web.min.js - 1k
Wrote ./assets/css/report.min.css - 7k
Wrote ./assets/css/frappe-web.css - 51k
Wrote ./assets/js/list.min.js - 66k
Wrote ./assets/js/dialog.min.js - 58k
Wrote ./assets/js/desk.min.js - 875k
Wrote ./assets/css/form.min.css - 2k
Wrote ./assets/js/editor.min.js - 26k
Wrote ./assets/css/erpnext.css - 1k
Wrote ./assets/css/desk.min.css - 256k
Wrote ./assets/css/module.min.css - 2k
frappe-bench-frappe-web: stopped
frappe-bench-frappe-worker: stopped
frappe-bench-node-socketio: stopped
frappe-bench-frappe-async-worker: stopped
frappe-bench-frappe-longjob-worker: stopped
frappe-bench-frappe-workerbeat: stopped
frappe-bench-frappe-async-worker: started
frappe-bench-frappe-longjob-worker: started
frappe-bench-frappe-workerbeat: started
frappe-bench-frappe-web: started
frappe-bench-frappe-worker: started
frappe-bench-node-socketio: started
________________________________________________________________________________
Bench: Open source installer + admin for Frappe and ERPNext (https://erpnext.com)

@c0mputerking I reopened the original thread and merged the posts.

i think you are on developer mode, so go to production mode please:
bench set-config developer_mode 0
or

Delete the developer_mode from your site "site_config.json" inside of your site folder...

after finished:

bench clear-cache

after finished restart your server or restart Bench, Nginx, Mysql, Supervisor

after finished:

bench update
then
bench update --upgrade to make sure you are update to last production mode.

Strange i get an error now when trying to run bench
bash: bench: command not found
However i can run it using /usr/local/bin/bench

I get a worse error when trying to turn developer mode off

    root@erp-2:/home/frappe/frappe-bench# /usr/local/bin/bench set-config developer_mode 0
    Traceback (most recent call last):
      File "/usr/lib/python2.7/runpy.py", line 162, 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 "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
        main()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
        click.Group(commands=commands)(prog_name='bench')
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
        return self.main(*args, **kwargs)
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
        rv = self.invoke(ctx)
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
        return f(get_current_context(), *args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/commands.py", line 29, in _func
        ret = f(frappe._dict(ctx.obj), *args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/commands.py", line 963, in set_config
        frappe.init(site=site)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 121, in init
        local.conf = _dict(get_site_config())
      File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 175, in get_site_config
        raise IncorrectSitePath, "{0} does not exist".format(site_config)
    frappe.exceptions.IncorrectSitePath: 404: Not Found

So i checked the /home/frappe/ site-config.json it does not contain anything about developer_mode

{
 "db_name": "dbname",
 "db_password": "dbpassword"

I also tried a bench update get errors about missing deps i try to install them but they are already installed see below

root@erp-2:/home/frappe/frappe-bench# /usr/local/bin/bench update
INFO:bench.utils:updating bench
Already up-to-date.
Traceback (most recent call last):
  File "./env/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/home/frappe/frappe-bench/env/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 73, in _update
    before_update(bench=bench_path, requirements=requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 587, in before_update
    validate_pillow_dependencies(bench, requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 595, in validate_pillow_dependencies
    exec_cmd("{pip} install Pillow".format(pip=pip))
  File "/home/frappe/bench-repo/bench/utils.py", line 99, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow
root@erp-2:/home/frappe/frappe-bench#
root@erp-2:/home/frappe/frappe-bench# sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
libjpeg8-dev is already the newest version.
liblcms2-dev is already the newest version.
libwebp-dev is already the newest version.
python-tk is already the newest version.
tcl8.6-dev is already the newest version.
tk8.6-dev is already the newest version.
zlib1g-dev is already the newest version.
libfreetype6-dev is already the newest version.
libtiff5-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@erp-2:/home/frappe/frappe-bench# /usr/local/bin/bench update
INFO:bench.utils:updating bench
Already up-to-date.
Traceback (most recent call last):
  File "./env/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/home/frappe/frappe-bench/env/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 73, in _update
    before_update(bench=bench_path, requirements=requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 587, in before_update
    validate_pillow_dependencies(bench, requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 595, in validate_pillow_dependencies
    exec_cmd("{pip} install Pillow".format(pip=pip))
  File "/home/frappe/bench-repo/bench/utils.py", line 99, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow

@c0mputerking ok, you first error is because of :
frappe.exceptions.IncorrectSitePath: 404: Not Found

can you restart your server and run bench update --upgrade

if it throw an error run: bench setup nginx and bench setup mysql or bench setup mysqld

how many sites do you have?

did you take a DB backup?

never put your credentials online dude !! even for offline server never do.

I did a restart and ran /usr/local/bin/bench update --upgrade get an error

/usr/local/bin/bench update --upgrade
INFO:bench.utils:updating bench
Already up-to-date.
Traceback (most recent call last):
  File "./env/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/home/frappe/frappe-bench/env/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 73, in _update
    before_update(bench=bench_path, requirements=requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 587, in before_update
    validate_pillow_dependencies(bench, requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 595, in validate_pillow_dependencies
    exec_cmd("{pip} install Pillow".format(pip=pip))
  File "/home/frappe/bench-repo/bench/utils.py", line 99, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow

Then ran /usr/local/bin/bench setup nginx works ok but now i have NO web access to ERPNext … also tried to run bench setup mysql and mysqld neither of which seem to be valid commands.

root@erp-2:/var/log/mysql# /usr/local/bin/bench setup mysqld
Usage: bench setup [OPTIONS] COMMAND [ARGS]...
 
Error: No such command "mysqld".
root@erp-2:/var/log/mysql# /usr/local/bin/bench setup mysql
Usage: bench setup [OPTIONS] COMMAND [ARGS]...
 
Error: No such command "mysql".

I only have one site but there are a files in sites folder, and I do have a database backup from a few days ago

:/home/frappe/frappe-bench/sites# ls -l
total 24
-rw-rw-r--  1 frappe frappe    33 Mar 22 19:33 apps.txt
drwxrwxr-x+ 4 frappe frappe     6 Mar 22 15:49 assets
-rw-r--r--  1 frappe frappe 49152 Apr 20 16:33 beat.schedule
-rw-r--r--  1 root   root       5 Apr 20 16:23 celerybeat.pid
-rw-r--r--  1 frappe frappe   416 Mar 24 14:54 common_site_config.json
-rw-rw-r--  1 frappe frappe    11 Mar 22 15:50 currentsite.txt
drwxrwxr-x+ 7 frappe frappe     9 Apr 19 20:02 erp-2.solar.computerking.ca
-rw-rw-r--  1 frappe frappe   920 Apr 11 16:12 languages.txt

ok, am not sure what did happend there, if you dont have a web access then there is something wrong with nginx setup or …

am just assuming but is this a local server by any how?

try run this:

also make a DB and Files backup just in case anything goes wrong…