gOdoo-cli 0.5.0__tar.gz → 0.5.2__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.2}/PKG-INFO +2 -2
  2. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/README.md +1 -1
  3. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/pyproject.toml +1 -1
  4. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/cli_common.py +0 -7
  5. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/bootstrap.py +1 -4
  6. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/launch.py +2 -10
  7. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/rpc/cli.py +4 -1
  8. godoo_cli-0.5.2/src/godoo_cli/commands/rpc/config_parameters.py +48 -0
  9. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/rpc/importer.py +2 -2
  10. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/rpc/modules.py +33 -1
  11. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/test.py +0 -2
  12. godoo_cli-0.5.2/src/godoo_cli/version.py +1 -0
  13. godoo_cli-0.5.0/src/godoo_cli/version.py +0 -1
  14. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/LICENSE +0 -0
  15. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/__init__.py +0 -0
  16. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/__main__.py +0 -0
  17. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/cli.py +0 -0
  18. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/__init__.py +0 -0
  19. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/config.py +0 -0
  20. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/db/__init__.py +0 -0
  21. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/db/cli.py +0 -0
  22. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/db/connection.py +0 -0
  23. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/db/passwords.py +0 -0
  24. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  25. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/rpc/translations.py +0 -0
  26. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/shell.py +0 -0
  27. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/commands/source_get.py +0 -0
  28. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/git/__init__.py +0 -0
  29. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/git/git_odoo.py +0 -0
  30. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  31. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/git/git_repo.py +0 -0
  32. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/git/git_url.py +0 -0
  33. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/git/zip_download.py +0 -0
  34. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/helpers/__init__.py +0 -0
  35. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/helpers/bootstrap.py +0 -0
  36. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/helpers/cli.py +0 -0
  37. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/helpers/odoo_files.py +0 -0
  38. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  39. {godoo_cli-0.5.0 → godoo_cli-0.5.2}/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.2
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
@@ -161,7 +161,7 @@ There are 3 Options to reset the Dev Env.
161
161
  container. (Vscode will prompt to reconnect if still open)
162
162
  2. From **Outside** the Container run `make reset-hard` in the project root to force rebuild the main Odoo container and
163
163
  then do the same as `make reset`
164
- 3. From **Inside** the Container run `make reset` to drop the DB and delete varlib and the bootstrap flag, which is way
164
+ 3. From **Inside** the Container run `make reset` to drop the DB and delete varlib and config file, which is way
165
165
  quicker than the other options.
166
166
 
167
167
  ### Manual Reset
@@ -119,7 +119,7 @@ There are 3 Options to reset the Dev Env.
119
119
  container. (Vscode will prompt to reconnect if still open)
120
120
  2. From **Outside** the Container run `make reset-hard` in the project root to force rebuild the main Odoo container and
121
121
  then do the same as `make reset`
122
- 3. From **Inside** the Container run `make reset` to drop the DB and delete varlib and the bootstrap flag, which is way
122
+ 3. From **Inside** the Container run `make reset` to drop the DB and delete varlib and config file, which is way
123
123
  quicker than the other options.
124
124
 
125
125
  ### Manual Reset
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gOdoo-cli"
3
- version = "0.5.0"
3
+ version = "0.5.2"
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"
@@ -73,13 +73,6 @@ class OdooPathCLIArgs:
73
73
  rich_help_panel="Path Options",
74
74
  )
75
75
 
76
- bootstrap_flag_location: Path = Option(
77
- ...,
78
- envvar="ODOO_BOOTSTRAP_FLAG",
79
- help="Location of the Bootstrap indicator file",
80
- rich_help_panel="Path Options",
81
- )
82
-
83
76
 
84
77
  @dataclass
85
78
  class RpcCLIArgs:
@@ -139,7 +139,6 @@ def bootstrap_odoo(
139
139
  workspace_addon_path=CLI.odoo_paths.workspace_addon_path,
140
140
  thirdparty_addon_path=CLI.odoo_paths.thirdparty_addon_path,
141
141
  odoo_conf_path=CLI.odoo_paths.conf_path,
142
- bootstrap_flag_location=CLI.odoo_paths.bootstrap_flag_location,
143
142
  db_filter=CLI.database.db_filter,
144
143
  db_host=CLI.database.db_host,
145
144
  db_port=CLI.database.db_port,
@@ -183,8 +182,6 @@ def bootstrap_odoo(
183
182
 
184
183
  LOGGER.info("Launching Bootstrap Commandline")
185
184
  ret = run_cmd(cmd_string).returncode
186
- if ret == 0:
187
- bootstrap_flag_location.touch()
188
- else:
185
+ if ret != 0:
189
186
  LOGGER.error("Odoo-Bin Returned %d", ret)
190
187
  return CLI.returner(ret)
@@ -56,7 +56,6 @@ def _launch_command(
56
56
  def pre_launch(
57
57
  odoo_main_path: Path,
58
58
  workspace_addon_path: Path,
59
- bootstrap_flag_location: Path,
60
59
  thirdparty_addon_path: Path,
61
60
  odoo_conf_path: Path,
62
61
  db_filter: str,
@@ -75,7 +74,7 @@ def pre_launch(
75
74
  install_base: bool = True,
76
75
  launch_or_bootstrap: bool = False,
77
76
  ):
78
- """Start Bootstrap if no bootstrap flag is found. And return Launch CMD.
77
+ """Start Bootstrap if no config file is found. And return Launch CMD.
79
78
 
80
79
  Parameters
81
80
  ----------
@@ -83,8 +82,6 @@ def pre_launch(
83
82
  Path to Odoo-bin folder
84
83
  workspace_addon_path : Path
85
84
  Path to workspace addons
86
- bootstrap_flag_location : Path
87
- path to bootstrap flag
88
85
  thirdparty_addon_path : Path
89
86
  path to thirdparty addons folder
90
87
  odoo_conf_path : Path
@@ -132,7 +129,7 @@ def pre_launch(
132
129
  log_file_path.unlink(missing_ok=True)
133
130
  extra_odoo_args.append("--logfile " + str(log_file_path.absolute()))
134
131
 
135
- bootstraped = bootstrap_flag_location.exists()
132
+ bootstraped = odoo_conf_path.exists()
136
133
  LOGGER.info("Bootstrap Flag Status: %s", bootstraped)
137
134
  ret = ""
138
135
  if not bootstraped:
@@ -150,7 +147,6 @@ def pre_launch(
150
147
  db_password=db_password,
151
148
  db_host=db_host,
152
149
  db_port=db_port,
153
- bootstrap_flag_location=bootstrap_flag_location,
154
150
  thirdparty_addon_path=thirdparty_addon_path,
155
151
  odoo_main_path=odoo_main_path,
156
152
  odoo_conf_path=odoo_conf_path,
@@ -193,7 +189,6 @@ def pre_launch(
193
189
  def launch_odoo(
194
190
  odoo_main_path=CLI.odoo_paths.bin_path,
195
191
  workspace_addon_path=CLI.odoo_paths.workspace_addon_path,
196
- bootstrap_flag_location=CLI.odoo_paths.bootstrap_flag_location,
197
192
  thirdparty_addon_path=CLI.odoo_paths.thirdparty_addon_path,
198
193
  odoo_conf_path=CLI.odoo_paths.conf_path,
199
194
  db_filter=CLI.database.db_filter,
@@ -218,7 +213,6 @@ def launch_odoo(
218
213
  launch_cmd = pre_launch(
219
214
  odoo_main_path=odoo_main_path,
220
215
  workspace_addon_path=workspace_addon_path,
221
- bootstrap_flag_location=bootstrap_flag_location,
222
216
  thirdparty_addon_path=thirdparty_addon_path,
223
217
  odoo_conf_path=odoo_conf_path,
224
218
  db_filter=db_filter,
@@ -253,7 +247,6 @@ def launch_import(
253
247
  ),
254
248
  odoo_main_path=CLI.odoo_paths.bin_path,
255
249
  workspace_addon_path=CLI.odoo_paths.workspace_addon_path,
256
- bootstrap_flag_location=CLI.odoo_paths.bootstrap_flag_location,
257
250
  thirdparty_addon_path=CLI.odoo_paths.thirdparty_addon_path,
258
251
  odoo_conf_path=CLI.odoo_paths.conf_path,
259
252
  db_filter=CLI.database.db_filter,
@@ -279,7 +272,6 @@ def launch_import(
279
272
  launch_cmd = pre_launch(
280
273
  odoo_main_path=odoo_main_path,
281
274
  workspace_addon_path=workspace_addon_path,
282
- bootstrap_flag_location=bootstrap_flag_location,
283
275
  thirdparty_addon_path=thirdparty_addon_path,
284
276
  odoo_conf_path=odoo_conf_path,
285
277
  db_filter=db_filter,
@@ -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)
@@ -46,7 +46,6 @@ def odoo_test(
46
46
  ),
47
47
  odoo_main_path=CLI.odoo_paths.bin_path,
48
48
  workspace_addon_path=CLI.odoo_paths.workspace_addon_path,
49
- bootstrap_flag_location=CLI.odoo_paths.bootstrap_flag_location,
50
49
  thirdparty_addon_path=CLI.odoo_paths.thirdparty_addon_path,
51
50
  odoo_conf_path=CLI.odoo_paths.conf_path,
52
51
  db_filter=CLI.database.db_filter,
@@ -101,7 +100,6 @@ def odoo_test(
101
100
  workspace_addon_path=workspace_addon_path,
102
101
  thirdparty_addon_path=thirdparty_addon_path,
103
102
  odoo_conf_path=odoo_conf_path,
104
- bootstrap_flag_location=bootstrap_flag_location,
105
103
  db_filter=db_filter,
106
104
  db_host=db_host,
107
105
  db_port=db_port,
@@ -0,0 +1 @@
1
+ __version__ = "0.5.2"
@@ -1 +0,0 @@
1
- __version__ = "0.5.0"
File without changes