gOdoo-cli 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/PKG-INFO +1 -1
  2. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/pyproject.toml +1 -1
  3. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/rpc/cli.py +4 -1
  4. godoo_cli-0.5.1/src/godoo_cli/commands/rpc/config_parameters.py +48 -0
  5. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/rpc/importer.py +2 -2
  6. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/rpc/modules.py +33 -1
  7. godoo_cli-0.5.1/src/godoo_cli/version.py +1 -0
  8. godoo_cli-0.5.0/src/godoo_cli/version.py +0 -1
  9. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/LICENSE +0 -0
  10. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/README.md +0 -0
  11. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/__init__.py +0 -0
  12. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/__main__.py +0 -0
  13. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/cli.py +0 -0
  14. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/cli_common.py +0 -0
  15. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/__init__.py +0 -0
  16. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/bootstrap.py +0 -0
  17. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/config.py +0 -0
  18. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/db/__init__.py +0 -0
  19. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/db/cli.py +0 -0
  20. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/db/connection.py +0 -0
  21. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/db/passwords.py +0 -0
  22. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/launch.py +0 -0
  23. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  24. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/rpc/translations.py +0 -0
  25. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/shell.py +0 -0
  26. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/source_get.py +0 -0
  27. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/commands/test.py +0 -0
  28. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/git/__init__.py +0 -0
  29. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/git/git_odoo.py +0 -0
  30. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  31. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/git/git_repo.py +0 -0
  32. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/git/git_url.py +0 -0
  33. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/git/zip_download.py +0 -0
  34. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/helpers/__init__.py +0 -0
  35. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/helpers/bootstrap.py +0 -0
  36. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/helpers/cli.py +0 -0
  37. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/helpers/odoo_files.py +0 -0
  38. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  39. {godoo_cli-0.5.0 → godoo_cli-0.5.1}/src/godoo_cli/helpers/system.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: godoo-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Wrapper around Odoo-Bin with some convinience RPC functions.
5
5
  Home-page: https://github.com/OpenJKSoftware/gOdoo
6
6
  License: LGPL-3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gOdoo-cli"
3
- version = "0.5.0"
3
+ version = "0.5.1"
4
4
  description = "Wrapper around Odoo-Bin with some convinience RPC functions."
5
5
  authors = ["Joshua Kreuder <Joshua_Kreuder@outlook.com>"]
6
6
  license = "LGPL-3"
@@ -1,7 +1,8 @@
1
1
  import typer
2
2
 
3
+ from .config_parameters import set_config_parameter
3
4
  from .importer import import_to_odoo
4
- from .modules import install_modules
5
+ from .modules import install_modules, uninstall_modules
5
6
  from .translations import dump_translations
6
7
 
7
8
 
@@ -12,6 +13,7 @@ def modules_cli_app():
12
13
  )
13
14
 
14
15
  app.command(name="install")(install_modules)
16
+ app.command(name="uninstall")(uninstall_modules)
15
17
  app.command(name="dump-translation")(dump_translations)
16
18
  return app
17
19
 
@@ -26,6 +28,7 @@ def rpc_cli_app():
26
28
  typer_instance=modules_cli_app(),
27
29
  name="modules",
28
30
  )
31
+ app.command(name="set-config-param")(set_config_parameter)
29
32
  app.command("import")(import_to_odoo)
30
33
 
31
34
  return app
@@ -0,0 +1,48 @@
1
+ import logging
2
+
3
+ import typer
4
+ from godoo_rpc.login import wait_for_odoo
5
+
6
+ from ...cli_common import CommonCLI
7
+
8
+ CLI = CommonCLI()
9
+ LOGGER = logging.getLogger(__name__)
10
+
11
+
12
+ @CLI.arg_annotator
13
+ def set_config_parameter(
14
+ param_name: str = typer.Argument(..., help=r"name of ir.config.parameter"),
15
+ param_value: str = typer.Argument(..., help="Value to set config parameter to (:unlink to delete the parameter)"),
16
+ rpc_host=CLI.rpc.rpc_host,
17
+ rpc_database=CLI.rpc.rpc_db_name,
18
+ rpc_user=CLI.rpc.rpc_user,
19
+ rpc_password=CLI.rpc.rpc_password,
20
+ ):
21
+ """Create/Set/Delete ir.config_parameter in Odoo"""
22
+
23
+ odoo_api = wait_for_odoo(
24
+ odoo_host=rpc_host,
25
+ odoo_db=rpc_database,
26
+ odoo_user=rpc_user,
27
+ odoo_password=rpc_password,
28
+ )
29
+
30
+ paramteter_model = odoo_api.session.env["ir.config_parameter"]
31
+
32
+ param_id = paramteter_model.search([("key", "=", param_name)])
33
+ param = paramteter_model.browse(param_id[0]) if param_id else None
34
+
35
+ if param_value == ":unlink":
36
+ if param:
37
+ LOGGER.warning("Removing Config Parameter: %s", param_name)
38
+ param.unlink()
39
+ else:
40
+ LOGGER.info("Param '%s' does not exist", param_name)
41
+ return
42
+
43
+ if param:
44
+ LOGGER.info("Setting param value for %s", param_name)
45
+ param.value = param_value
46
+ else:
47
+ LOGGER.info("Creating new Config Parameter: %s", param_name)
48
+ paramteter_model.create({"key": param_name, "value": param_value})
@@ -64,7 +64,7 @@ def import_to_odoo(
64
64
  odoo_api=odoo_api,
65
65
  read_path=path.absolute(),
66
66
  data_regex=file_regex,
67
- product_image_regex="" if path.is_file() else product_image_regex,
68
- check_dataset_timestamp="" if path.is_file() else check_data_timestamp,
67
+ product_image_regex=False if path.is_file() else product_image_regex,
68
+ check_dataset_timestamp=check_data_timestamp,
69
69
  skip_existing_ids=skip_existing_ids,
70
70
  )
@@ -93,7 +93,7 @@ def install_modules(
93
93
  rpc_password=CLI.rpc.rpc_password,
94
94
  upgrade: bool = typer.Option(True, help="Upgrae Module if already installed"),
95
95
  ):
96
- """Install or upgrade module. Can act on multiple modules with % wildcard"""
96
+ """Install or upgrade Odoo modules via RPC. Can act on multiple modules with % wildcard"""
97
97
 
98
98
  odoo_api = wait_for_odoo(
99
99
  odoo_host=rpc_host,
@@ -110,3 +110,35 @@ def install_modules(
110
110
  else:
111
111
  LOGGER.warn("Could not find modules with Query: '%s'", module_name_query)
112
112
  return CLI.returner(1)
113
+
114
+
115
+ @CLI.arg_annotator
116
+ def uninstall_modules(
117
+ module_name_query: str = typer.Argument(
118
+ ..., help=r"Module Internal name(s), comma seperated. Will use ilike Match if \% is present"
119
+ ),
120
+ rpc_host=CLI.rpc.rpc_host,
121
+ rpc_database=CLI.rpc.rpc_db_name,
122
+ rpc_user=CLI.rpc.rpc_user,
123
+ rpc_password=CLI.rpc.rpc_password,
124
+ ):
125
+ """Uninstall odoo Modules via RPC. Can act on multiple modules with % wildcard"""
126
+
127
+ odoo_api = wait_for_odoo(
128
+ odoo_host=rpc_host,
129
+ odoo_db=rpc_database,
130
+ odoo_user=rpc_user,
131
+ odoo_password=rpc_password,
132
+ )
133
+
134
+ if modules := rpc_get_modules(odoo_api, module_name_query):
135
+ uninstall_module_ids = [m.id for m in modules if m.state == "installed"]
136
+ if uninstall_module_ids:
137
+ uninstall_modules = modules.browse(uninstall_module_ids)
138
+ LOGGER.info("Uninstalling Module: " + ", ".join(uninstall_modules.mapped("name")))
139
+ uninstall_modules.button_immediate_uninstall()
140
+ else:
141
+ LOGGER.warn("Found Modules, but didn't do anything on DB.")
142
+ else:
143
+ LOGGER.warn("Could not find modules with Query: '%s'", module_name_query)
144
+ return CLI.returner(1)
@@ -0,0 +1 @@
1
+ __version__ = "0.5.1"
@@ -1 +0,0 @@
1
- __version__ = "0.5.0"
File without changes
File without changes