How to unassign from action button?

Hi,
If we select multiple items the action button will appear. Inside we can find Assign To option, Using that we can assign multiple item at once. Similarly, how to mark unassigned by bulk selection.

Currently this feature is not available out of the box. Want to contribute?

@crazy_explorer and @saurabh6790 To add such functionality, there are 2 JavaScript files must be modified, 1 JavaScript file must be created and 1 Python file must be created to reverse the action, unless if it is just about setting the status to Cancelled then 1 Python file must be modified.

I’ll try to do it and contribute it to Frappe.

2 Likes

@crazy_explorer & @saurabh6790 This is my contribution.

https://github.com/frappe/frappe/pull/17729

If they don’t merge my modification, I will convert it to a plugin so you can install it yourself.

2 Likes

Hello @kid1194, Thanks for your contribution. I am new to ERPNext, Could you please guide me to do this?

Thank you.

@crazy_explorer ERPNext didn’t accept my change so I will create a plugin for you.

@crazy_explorer Here is the plugin. Please check it out and tell me how it works for you.

1 Like

Hello @kid1194,

I’m facing this error:

erpnext@ubuntu-OptiPlex-980:/opt/bench/erpnext$ bench get-app https://github.com/kid1194/frappe-list-unassign-from
Getting frappe-list-unassign-from
$ git clone https://github.com/kid1194/frappe-list-unassign-from  --depth 1 --origin upstream
Cloning into 'frappe-list-unassign-from'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 27 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (27/27), 7.44 KiB | 7.44 MiB/s, done.
Installing frappe_list_unassign_from
$ /opt/bench/erpnext/env/bin/python -m pip install --quiet --upgrade -e /opt/bench/erpnext/apps/frappe_list_unassign_from
$ bench build --app frappe_list_unassign_from
Linking /opt/bench/erpnext/apps/frappe_list_unassign_from/frappe_list_unassign_from/public to ./assets/frappe_list_unassign_from                                                                                                                ✔ Application Assets Linked


yarn run v1.22.19
$ node esbuild --production --apps frappe_list_unassign_from --run-build-command
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
File                                                        Size

frappe_list_unassign_from/dist/js/
└─ unassign_from.bundle.3NKDLTZ4.js                         2.51 Kb

 DONE  Total Build Time: 1.174s

Done in 4.46s.
$ supervisorctl restart frappe:
frappe: ERROR (no such group)
frappe: ERROR (no such group)
ERROR:
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 121, in cli
    raise e
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 111, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/make.py", line 142, in get_app
    get_app(
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 371, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 198, in install
    install_app(
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 436, in install_app
    bench.reload()
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 142, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 280, in restart_supervisor_processes
    bench.run(f"{sudo}supervisorctl restart {group}")
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 43, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 126, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

erpnext@ubuntu-OptiPlex-980:/opt/bench/erpnext$

@crazy_explorer I don’t think that the error is because of the plugin, but I will check the code and if there is any problem I will fix it.

@crazy_explorer There were some bugs I found in the code. I have updated the plugin and you should do so. Follow the instructions in the plugin page.

Hello @kid1194,

I’m getting this error:

erpnext@mypc:/opt/bench/erpnext$ bench get-app https://github.com/kid1194/frappe-list-unassign-from
Getting frappe-list-unassign-from
$ git clone https://github.com/kid1194/frappe-list-unassign-from  --depth 1 --origin upstream
Cloning into 'frappe-list-unassign-from'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 28 (delta 1), reused 22 (delta 1), pack-reused 0
Receiving objects: 100% (28/28), 7.56 KiB | 7.56 MiB/s, done.
Resolving deltas: 100% (1/1), done.
Installing frappe_list_unassign_from
$ /opt/bench/erpnext/env/bin/python -m pip install --quiet --upgrade -e /opt/bench/erpnext/apps/frappe_list_unassign_from
$ bench build --app frappe_list_unassign_from
Linking /opt/bench/erpnext/apps/frappe_list_unassign_from/frappe_list_unassign_from/public to ./assets/frappe_list_unassign_from                                                                  ✔ Application Assets Linked


yarn run v1.22.19
$ node esbuild --production --apps frappe_list_unassign_from --run-build-command
✘ [ERROR] No matching export in "../frappe_list_unassign_from/frappe_list_unassign_from/public/js/libs/custom_bulk_operations.js" for import "CustomBulkOperations"

    ../frappe_list_unassign_from/frappe_list_unassign_from/public/js/unassign_froms_v13.bundle.js:2:4:
      2 │     CustomBulkOperations
        ╵     ~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "../frappe_list_unassign_from/frappe_list_unassign_from/public/js/libs/custom_bulk_operations.js" for import "CustomBulkOperations"

    ../frappe_list_unassign_from/frappe_list_unassign_from/public/js/unassign_from.bundle.js:2:4:
      2 │     CustomBulkOperations
        ╵     ~~~~~~~~~~~~~~~~~~~~

 ERROR  There were some problems during build

Error: Build failed with 2 errors:
../frappe_list_unassign_from/frappe_list_unassign_from/public/js/unassign_from.bundle.js:2:4: ERROR: No matching export in "../frappe_list_unassign_from/frappe_list_unassign_from/public/js/libs/custom_bulk_operations.js" for import "CustomBulkOperations"
../frappe_list_unassign_from/frappe_list_unassign_from/public/js/unassign_froms_v13.bundle.js:2:4: ERROR: No matching export in "../frappe_list_unassign_from/frappe_list_unassign_from/public/js/libs/custom_bulk_operations.js" for import "CustomBulkOperations"
    at failureErrorWithLog (/opt/bench/erpnext/apps/frappe/node_modules/esbuild/lib/main.js:1600:15)
    at /opt/bench/erpnext/apps/frappe/node_modules/esbuild/lib/main.js:1246:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
Done in 1.26s.
$ supervisorctl restart frappe:
frappe: ERROR (no such group)
frappe: ERROR (no such group)
ERROR:
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 121, in cli
    raise e
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 111, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/make.py", line 142, in get_app
    get_app(
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 371, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 198, in install
    install_app(
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 436, in install_app
    bench.reload()
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 142, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 280, in restart_supervisor_processes
    bench.run(f"{sudo}supervisorctl restart {group}")
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 43, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 126, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError
erpnext@mypc:/opt/bench/erpnext$

@crazy_explorer Sorry for the mistake. I have updated the plugin.

Hi @kid1194,

Thanks for your support. Installation is done. But there is a problem from unassign from.
Please check the below error.

### App Versions

{
“erpnext”: “14.0.0-dev”,
“frappe”: “14.4.0”,
“frappe_list_unassign_from”: “1.0.3”,
“payments”: “0.0.1”
}

### Route

List/Lead/List

### Trackeback

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 83, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1598, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/desk/search.py”, line 63, in search_link
search_widget(
File “apps/frappe/frappe/desk/search.py”, line 126, in search_widget
raise e
File “apps/frappe/frappe/desk/search.py”, line 110, in search_widget
is_whitelisted(frappe.get_attr(query))
File “apps/frappe/frappe/init.py”, line 1588, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1336, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1006, in _find_and_load_unlocked
File “”, line 688, in _load_unlocked
File “”, line 879, in exec_module
File “”, line 1017, in get_code
File “”, line 947, in source_to_code
File “”, line 241, in _call_with_frames_removed
File “apps/frappe_list_unassign_from/frappe_list_unassign_from/api/unassign_from.py”, line 14
.where(dToDo.reference_type.eq(doctype))
IndentationError: unexpected indent

### Request Data

{
“type”: “GET”,
“args”: {
“doctype”: “Lead”,
“txt”: “”,
“query”: “frappe_list_unassign_from.api.unassign_from.search_link”,
“filters”: “{"docname":["CRM-LEAD-2022-00002","CRM-LEAD-2022-00001"]}”
},
“headers”: {},
“error_handlers”: {},
“url”: “/api/method/frappe.desk.search.search_link”
}

### Response Data

{
“exception”: “IndentationError: unexpected indent”
}

@crazy_explorer This is a bug. I will check the code and get back to you.

@crazy_explorer I have updated the plugin so please update it as well and I hope that everything works well.

1 Like

Hello @kid1194,
This one working fine. Thank you so much :heart:

1 Like