Skip to content

Commit 9a3facf

Browse files
authored
Merge pull request #484 from itpp-labs/17.0-sync
[17.0] sync
2 parents a2997b3 + b7deff0 commit 9a3facf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+7554
-13
lines changed

.DINAR/image/dependencies/pip.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
# Python dependencies
2+
bravado_core
3+
jsonschema<4
4+
swagger_spec_validator
5+
# Sync Studio
6+
pyTelegramBotAPI
7+
markdown==3.6
8+
pyyaml

.DINAR/image/src/addons.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# see https://github.com/Tecnativa/doodba#optodoocustomsrcaddonsyaml
2+
---
3+
ENV:
4+
DEFAULT_REPO_PATTERN: https://github.com/OCA/{}.git
5+
6+
queue:
7+
- "*"

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
[![[email protected]](https://itpp.dev/images/infinity-readme.png)](mailto:[email protected])
2-
# [17.0] Odoo Integration Modules
1+
<h1 align="center">¡Welcome!</h1>
32

4-
:open_file_folder: Get a **.zip** file with all needed dependencies:
3+
<p align="center"> <b>Sync 🪬 Studio</b> is a groundbreaking meta-application<br/>that empowers you to build <b>Odoo ✨ Connectors</b> in just a few hours. </p>
54

5+
<div align="center">
6+
<a target="_blank" href="https://odoomagic.com/"><img src="https://github.com/itpp-labs/sync-addons/assets/186131/b7ae8ced-44f4-498d-b111-2fc4e3d1171b" alt="Sync 🪬 Studio"/></a>
7+
</div>
8+
9+
<p align="center"><em>Click the image for a quick introduction.</em></p>
610

11+
# Is It Magic?
712

8-
:star: Star this repo if you **like** it!
9-
10-
Other Addons
11-
============
12-
13-
| Repository | Versions |
14-
|------------|----------|
15-
| [itpp-labs/**pos-addons**](https://github.com/itpp-labs/pos-addons) | [[17.0]](https://github.com/itpp-labs/pos-addons/tree/17.0#readme) [[16.0]](https://github.com/itpp-labs/pos-addons/tree/16.0#readme) [[15.0]](https://github.com/itpp-labs/pos-addons/tree/15.0#readme) [[14.0]](https://github.com/itpp-labs/pos-addons/tree/14.0#readme) [[13.0]](https://github.com/itpp-labs/pos-addons/tree/13.0#readme) [[12.0]](https://github.com/itpp-labs/pos-addons/tree/12.0#readme) [[11.0]](https://github.com/itpp-labs/pos-addons/tree/11.0#readme) [[10.0]](https://github.com/itpp-labs/pos-addons/tree/10.0#readme) [[9.0]](https://github.com/itpp-labs/pos-addons/tree/9.0#readme) [[8.0]](https://github.com/itpp-labs/pos-addons/tree/8.0#readme) [[7.0]](https://github.com/itpp-labs/pos-addons/tree/7.0#readme) |
16-
| [itpp-labs/**sync-addons**](https://github.com/itpp-labs/sync-addons) | [[17.0]](https://github.com/itpp-labs/sync-addons/tree/17.0#readme) [[16.0]](https://github.com/itpp-labs/sync-addons/tree/16.0#readme) [[15.0]](https://github.com/itpp-labs/sync-addons/tree/15.0#readme) [[14.0]](https://github.com/itpp-labs/sync-addons/tree/14.0#readme) [[13.0]](https://github.com/itpp-labs/sync-addons/tree/13.0#readme) [[12.0]](https://github.com/itpp-labs/sync-addons/tree/12.0#readme) [[11.0]](https://github.com/itpp-labs/sync-addons/tree/11.0#readme) [[10.0]](https://github.com/itpp-labs/sync-addons/tree/10.0#readme) [[9.0]](https://github.com/itpp-labs/sync-addons/tree/9.0#readme) [[8.0]](https://github.com/itpp-labs/sync-addons/tree/8.0#readme) |
17-
| [itpp-labs/**access-addons**](https://github.com/itpp-labs/access-addons) | [[17.0]](https://github.com/itpp-labs/access-addons/tree/17.0#readme) [[16.0]](https://github.com/itpp-labs/access-addons/tree/16.0#readme) [[15.0]](https://github.com/itpp-labs/access-addons/tree/15.0#readme) [[14.0]](https://github.com/itpp-labs/access-addons/tree/14.0#readme) [[13.0]](https://github.com/itpp-labs/access-addons/tree/13.0#readme) [[12.0]](https://github.com/itpp-labs/access-addons/tree/12.0#readme) [[11.0]](https://github.com/itpp-labs/access-addons/tree/11.0#readme) [[10.0]](https://github.com/itpp-labs/access-addons/tree/10.0#readme) [[9.0]](https://github.com/itpp-labs/access-addons/tree/9.0#readme) [[8.0]](https://github.com/itpp-labs/access-addons/tree/8.0#readme) |
13+
Not quite. **Sync 🪬 Studio** harnesses the power of AI to generate safe, reusable code, making connector development as simple as copy-pasting. Let your imagination and **Sync 🪬 Studio** work together to create seamless integrations effortlessly.

sync/README.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.. image:: https://itpp.dev/images/infinity-readme.png
2+
:alt: Tested and maintained by IT Projects Labs
3+
:target: https://odoomagic.com
4+
5+
.. image:: https://img.shields.io/badge/license-MIT-blue.svg
6+
:target: https://opensource.org/licenses/MIT
7+
:alt: License: MIT
8+
9+
=============
10+
Sync Studio
11+
=============
12+
13+
Synchronize something with anything:
14+
15+
* System X ↔ Odoo
16+
* Odoo 1 ↔ Odoo 2
17+
* System X ↔ System Y
18+
19+
Provides a single place to handle synchronization trigered by one of the following events:
20+
21+
* **Cron** -- provided by ``ir.cron``
22+
* **DB Event** -- provided by ``base.automation``
23+
* **Incoming webhook** -- modified version of ``/website/action`` controller from ``website`` module
24+
* **Manual Triggering** -- provided by ``ir.actions.server``. User needs to click a button to run this action
25+
26+
Difference with built-in code evaluation:
27+
28+
* Allows to use json format for incomming webhooks
29+
* Provides helpers for resource linking. See *Links* section in `<doc/index.rst>`__
30+
* Uses queue_job module as a job broker
31+
* Asynchronous calls to split big task into few small ones
32+
* Allows repeat job on temporary fails (e.g. when external API is not available)
33+
34+
Roadmap
35+
=======
36+
37+
* Code widget: show line numbers
38+
* Webhooks: add a possibility to retry failed webhook (e.g. to debug code)
39+
* Webhooks: during the migration rename `website` appearances in links to `sync`. We decided not to do this in the stable branch to not break existing integrations
40+
41+
Developer Hints
42+
===============
43+
44+
Public webhook address
45+
----------------------
46+
47+
If you run Odoo locally and need to test webhook, your Odoo server should be available via public URL. You can either use specialized services like https://ngrok.com/ or make proxing via ssh tunneling as described in the next section. Once it's done set corresponding ``https://...`` value for ``web.base.url`` parameter (menu ``[[ Settings ]] >> System Parameters``). Also, you should set any value to `web.base.url.freeze <https://odoo-source.com/?q=web.base.url.freeze&i=nope&files=&excludeFiles=po%24%7Cpot%24%7Cyml%24%7Cyaml%24%7Ccss%24%7C%2Fstatic%2Flib%2F&repos=odoo>`__ to avoid automatic change of ``web.base.url``.
48+
49+
SSH tunneling
50+
~~~~~~~~~~~~~
51+
52+
* Connect your server:
53+
54+
* Edit file ``/etc/ssh/sshd_config``:
55+
56+
* Find ``GatewayPorts`` attribute and set value to ``yes``
57+
58+
* Restart ssh daemon::
59+
60+
service ssh restart
61+
62+
* Connect to your server with ``-R`` attribute::
63+
64+
ssh [email protected] -R 0.0.0.0:8069:localhost:8069
65+
66+
Now you can use ``http://yourserver.example:8069`` as a value for ``web.base.url`` in Odoo.
67+
68+
Few more steps requires to use https connection (e.g. telegram api works with https only). In your server do as following:
69+
70+
* Install nginx in your server
71+
* Add nginx config::
72+
73+
server {
74+
listen 80;
75+
server_name yourserver.example;
76+
location / {
77+
proxy_set_header Host $host;
78+
proxy_pass http://localhost:8069;
79+
}
80+
}
81+
82+
* Install `certbot <https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx.html>`__
83+
* Run
84+
::
85+
86+
sudo certbot --nginx
87+
88+
* Done!
89+
90+
Questions?
91+
==========
92+
93+
To get an assistance on this module contact us by email :arrow_right: [email protected]
94+
95+
Further information
96+
===================
97+
98+
Tested on `Odoo 16.0 <https://github.com/odoo/odoo/commit/6565502494aa1c00104beb59698e359b8769553f>`__

sync/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# License MIT (https://opensource.org/licenses/MIT).
2+
3+
from . import models
4+
from . import controllers
5+
from . import lib
6+
from . import tools

sync/__manifest__.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2020-2021,2024-2025 Ivan Yelizariev <https://twitter.com/yelizariev>
2+
# Copyright 2020-2021 Denis Mudarisov <https://github.com/trojikman>
3+
# Copyright 2021 Ilya Ilchenko <https://github.com/mentalko>
4+
# License MIT (https://opensource.org/licenses/MIT).
5+
6+
{
7+
"name": "Sync 🪬 Studio",
8+
"summary": """Join the Amazing 😍 Community ⤵️""",
9+
"category": "VooDoo ✨ Magic",
10+
"version": "17.0.13.0.1",
11+
"application": True,
12+
"author": "Ivan Yelizariev",
13+
"support": "[email protected]",
14+
"website": "https://sync_studio.t.me/",
15+
"license": "Other OSI approved licence", # MIT
16+
# The `partner_telegram` dependency is not directly needed,
17+
# but it plays an important role in the **Sync 🪬 Studio** ecosystem
18+
# and is added for the quick onboarding of new **Cyber ✨ Pirates**.
19+
"depends": ["base_automation", "mail", "queue_job", "partner_telegram"],
20+
"external_dependencies": {"python": ["markdown", "pyyaml"], "bin": []},
21+
"data": [
22+
"security/sync_groups.xml",
23+
"security/ir.model.access.csv",
24+
"views/sync_menus.xml",
25+
"views/ir_logging_views.xml",
26+
"views/sync_job_views.xml",
27+
"views/sync_trigger_cron_views.xml",
28+
"views/sync_trigger_automation_views.xml",
29+
"views/sync_trigger_webhook_views.xml",
30+
"views/sync_trigger_button_views.xml",
31+
"views/sync_order_views.xml",
32+
"views/sync_task_views.xml",
33+
"views/sync_link_views.xml",
34+
"views/sync_project_views.xml",
35+
"data/queue_job_function_data.xml",
36+
],
37+
"assets": {
38+
"web.assets_backend": [
39+
"sync/static/src/scss/src.scss",
40+
],
41+
},
42+
"demo": [
43+
"data/sync_project_unittest_demo.xml",
44+
],
45+
"qweb": [],
46+
"post_load": None,
47+
"pre_init_hook": None,
48+
"post_init_hook": None,
49+
"uninstall_hook": None,
50+
"auto_install": False,
51+
"installable": True,
52+
}

sync/controllers/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License MIT (https://opensource.org/licenses/MIT).
2+
3+
from . import webhook

sync/controllers/webhook.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2020 Ivan Yelizariev <https://twitter.com/yelizariev>
2+
# Copyright 2021 Denis Mudarisov <https://github.com/trojikman>
3+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
4+
5+
from odoo import http
6+
7+
from ..lib.controllers.main import Website
8+
9+
10+
class Webhook(Website):
11+
@http.route(
12+
[
13+
"/website/action-json/<path_or_xml_id_or_id>",
14+
"/website/action-json/<path_or_xml_id_or_id>/<path:path>",
15+
],
16+
type="json",
17+
auth="public",
18+
website=True,
19+
csrf=False,
20+
)
21+
def actions_server_json(self, path_or_xml_id_or_id, **post):
22+
res = self.actions_server(path_or_xml_id_or_id, **post)
23+
return res.data
24+
25+
@http.route(
26+
[
27+
"/website/action-http/<path_or_xml_id_or_id>",
28+
"/website/action-http/<path_or_xml_id_or_id>/<path:path>",
29+
],
30+
type="http",
31+
auth="public",
32+
website=True,
33+
csrf=False,
34+
)
35+
def actions_server_http(self, path_or_xml_id_or_id, **post):
36+
return self.actions_server(path_or_xml_id_or_id, **post)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!-- Copyright 2020 Ivan Yelizariev <https://twitter.com/yelizariev>
3+
License MIT (https://opensource.org/licenses/MIT). -->
4+
<odoo>
5+
<record id="queue_job_function_task_run" model="queue.job.function">
6+
<field name="model_id" ref="sync.model_sync_task" />
7+
<field name="method">run</field>
8+
<field
9+
name="retry_pattern"
10+
eval="{1: 5 * 60, 2: 15 * 60, 3: 60 * 60, 4: 3 * 60 * 60}"
11+
/>
12+
</record>
13+
</odoo>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<data>
4+
<record id="sync_project_context_odoo2odoo_demo" model="sync.project.context">
5+
<field name="name">odoo2odoo_demo</field>
6+
<field name="display_name">Odoo2odoo (Demo)</field>
7+
</record>
8+
<record id="sync_project_context_telegram_demo" model="sync.project.context">
9+
<field name="name">telegram_demo</field>
10+
<field name="display_name">Telegram (Demo)</field>
11+
</record>
12+
<record id="sync_project_context_trello_demo" model="sync.project.context">
13+
<field name="name">trello</field>
14+
<field name="display_name">Trello (Demo)</field>
15+
</record>
16+
<record id="sync_project_context_github_demo" model="sync.project.context">
17+
<field name="name">github</field>
18+
<field name="display_name">Github (Demo)</field>
19+
</record>
20+
<record id="sync_project_context_math_demo" model="sync.project.context">
21+
<field name="name">math</field>
22+
<field name="display_name">Math functions (Demo)</field>
23+
</record>
24+
</data>
25+
</odoo>

0 commit comments

Comments
 (0)