Repository: OCA/search-engine (language: python)

Issue:
[14.0] Misc migration to v14
Do not merge yet
- [ ] migrate to new queu job in V13 and rebase this work #68
- [ ] update algolia client in V13 and rebase this work
[14.0] connector_search_engine: Migration to v14
Replaces #67



Discussion / hints:
I can't edit the original post so here is the actual state of the PR:

 - [x] migrate to new queu job in V13 and rebase this work #68 
 - [ ] update algolia client in V13 and rebase this work #73 
@sebastienbeau @PierrickBrun sorry but this PR looks messy both in terms of contents and commits. Can we split things? Do you mind if I do it?

I'd port queue job and base_jsonify changes as they are in separated PRs even if the build won't run. 
step 1 https://github.com/OCA/search-engine/pull/82
step 2 https://github.com/OCA/search-engine/pull/83
step 3 https://github.com/OCA/search-engine/pull/84


Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3c97f7ad..66488bcf 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,6 @@ exclude: |
   (?x)
   # NOT INSTALLABLE ADDONS
   ^connector_algolia/|
-  ^connector_elasticsearch/|
   # END NOT INSTALLABLE ADDONS
   # Files and folders generated by bots, to avoid loops
   ^setup/|/static/description/index\.html$|
diff --git a/connector_elasticsearch/__manifest__.py b/connector_elasticsearch/__manifest__.py
index 6861dd36..f862cd5e 100644
--- a/connector_elasticsearch/__manifest__.py
+++ b/connector_elasticsearch/__manifest__.py
@@ -5,7 +5,7 @@
     "name": "connector_elasticsearch",
     "category": "Connector",
     "summary": "Connector For Elasticsearch Search Engine",
-    "version": "13.0.2.4.1",
+    "version": "14.0.1.0.0",
     "license": "AGPL-3",
     "author": "ACSONE SA/NV, Odoo Community Association (OCA)",
     "website": "https://github.com/OCA/search-engine",
@@ -22,6 +22,6 @@
         "views/se_menu.xml",
     ],
     "demo": ["demo/backend_demo.xml"],
-    "external_dependencies": {"python": ["elasticsearch", "requests"]},
-    "installable": False,
+    "external_dependencies": {"python": ["elasticsearch>=7.0.0,<8.0.0", "requests"]},
+    "installable": True,
 }
diff --git a/requirements.txt b/requirements.txt
index 6f3f1c6f..f706fd1d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,4 @@
 # generated from manifests external_dependencies
+elasticsearch>=7.0.0,<8.0.0
+requests
 unidecode
diff --git a/setup/connector_elasticsearch/odoo/addons/connector_elasticsearch b/setup/connector_elasticsearch/odoo/addons/connector_elasticsearch
new file mode 120000
index 00000000..d5e1b16f
--- /dev/null
+++ b/setup/connector_elasticsearch/odoo/addons/connector_elasticsearch
@@ -0,0 +1,1 @@
+../../../../connector_elasticsearch
\ No newline at end of file
diff --git a/setup/connector_elasticsearch/setup.py b/setup/connector_elasticsearch/setup.py
new file mode 100644
index 00000000..28c57bb6
--- /dev/null
+++ b/setup/connector_elasticsearch/setup.py
@@ -0,0 +1,6 @@
+import setuptools
+
+setuptools.setup(
+    setup_requires=['setuptools-odoo'],
+    odoo_addon=True,
+)


Test patch:
diff --git a/connector_elasticsearch/tests/test_connector_elasticsearch.py b/connector_elasticsearch/tests/test_connector_elasticsearch.py
index dd7fa7c5..9a684310 100644
--- a/connector_elasticsearch/tests/test_connector_elasticsearch.py
+++ b/connector_elasticsearch/tests/test_connector_elasticsearch.py
@@ -68,7 +68,7 @@ def test_index_adapter(self):
         self.assertEqual(request.method, "POST")
         self.assertEqual(self.parse_path(request.uri), "/_bulk")
         body = request.body.decode("utf-8")
-        lines = [l for l in filter(lambda l: l, body.split("\n"))]
+        lines = [line for line in filter(lambda line: line, body.split("\n"))]
         # we must have 2 lines: 1 for the index op and 1 with data
         self.assertEqual(len(lines), 2)
         index_action = json.loads(lines[0])
@@ -128,6 +128,6 @@ def test_missing_object_key(self):
     @mute_logger("odoo.addons.connector_search_engine.models.se_binding")
     def test_index_adapter_delete_nonexisting_documents(self):
         """We try to delete records that do not exist.
-           Because it does not matter, it is just ignored. No exception.
+        Because it does not matter, it is just ignored. No exception.
         """
         self.adapter.delete(["donotexist", "donotexisteither"])