Create a server action record that allows user to uninstall many apps at once
Uninstall Modules
Module (type ir_module to get to the right one)
| import inspect | |
| ops = { | |
| "+": lambda a, b: a + b, | |
| "-": lambda a, b: a - b, | |
| "x": lambda a, b: a * b, | |
| "/": lambda a, b: a / b, | |
| "sqrt": lambda a: a ** 0.5, | |
| "ternary_operator": lambda a, b, c: a + b + c + 1, | |
| } |
| # Minimal postgresql version for each Odoo version | |
| MINIMAL_PG_VERSIONS = { | |
| "6.0": "9.5", | |
| "7.0": "9.5", | |
| "8.0": "9.5", | |
| "9.0": "9.5", | |
| "10.0": "9.5", | |
| "11.0": "9.5", | |
| "12.0": "9.5", | |
| "saas~12.3": "10", |
| git merge-base --is-ancestor <commit_you_are_interrested_in> HEAD && echo "yes" || echo "no" |
| import xmlrpc.client; xmlrpc.client.ServerProxy('https://<domain_name>/xmlrpc/2/common').version() |
| sync_filestore_to_remote() { | |
| # sends a local filestore to a remote server in batches (1 per filestore folder) | |
| # the goal is too use less additional space than a big zip file, while not sending | |
| # each file individually (which might trigger a network rate limiting) | |
| args=("$@") | |
| ELEMENTS=${#args[@]} | |
| if [ $ELEMENTS -ne 3 ]; then | |
| echo "Usage: sync_filestore_to_remote local_filestore_path remote_host remote_filestore_path" | |
| exit 1 |
| # usefull when apps are in a weird state that requires changing the state in SQL | |
| # or if there was an (un)install issue and the database is left in a weird state | |
| # use this in the shell if you can't restart the odoo instance (because of mulitple tenants for example) | |
| env.cr.commit() | |
| env.registry.registry_invalidated = True | |
| env.registry.signal_changes() |
| #!/usr/bin/env python3 | |
| # Extended python -m http.serve with --username and --password parameters for | |
| # basic auth, based on https://gist.github.com/fxsjy/5465353 | |
| from functools import partial | |
| from http.server import SimpleHTTPRequestHandler, test | |
| import base64 | |
| import os |
| standard_apps=$(find /home/odoo/src/{odoo,enterprise,themes} -name __manifest__.py | jq -nRr '[inputs] | map(split("/")[-2]) | join(",")'); psql -c "select name, state from ir_module_module where NOT (name = ANY('{$standard_apps,studio_customization}'::text[]) ) and state not in ('uninstalled', 'uninstallable') order by name;" | |
| # explanation of the code | |
| # find /home/odoo/src/{odoo,enterprise,themes} -name "__manifest__.py" --> list the path to each odoo standard modules | |
| # in Jq | |
| # [inputs] --> transforms the input text to an array of lines | |
| # map(split("/")[-2]) --> for each line, get the directory's name |
| while ! rsync <put_all_rsync_parameter_here> ; do echo 'rsync failed, retrying'; sleep 3; done; | |
| # use --info=progress2 to see the evolution in betwen attemptsd |