Skip to content

Commit

Permalink
Merge pull request #311 from itpp-labs/17.0
Browse files Browse the repository at this point in the history
Syncing from upstream itpp-labs/sync-addons (17.0)
  • Loading branch information
bt-admin authored Feb 27, 2025
2 parents 80abef6 + 9a3facf commit 2ab02dc
Show file tree
Hide file tree
Showing 73 changed files with 7,574 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .DINAR/build-date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fresh Odoo 17 build
Odoo 17 build with new deps
7 changes: 7 additions & 0 deletions .DINAR/image/dependencies/pip.txt
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# Python dependencies
bravado_core
jsonschema<4
swagger_spec_validator
# Sync Studio
pyTelegramBotAPI
markdown==3.6
pyyaml
6 changes: 6 additions & 0 deletions .DINAR/image/src/addons.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# see https://github.com/Tecnativa/doodba#optodoocustomsrcaddonsyaml
---
ENV:
DEFAULT_REPO_PATTERN: https://github.com/OCA/{}.git

queue:
- "*"
30 changes: 15 additions & 15 deletions .github/workflows/DINAR-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"
- name: Check Python Version
run:
echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >>
Expand All @@ -56,7 +56,7 @@ jobs:
ref: master
- uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"
- name: Install python tools
run: |
pip install plumbum PyGithub pyyaml
Expand Down Expand Up @@ -122,15 +122,15 @@ jobs:
pip install plumbum PyGithub pyyaml
- name: Download Docker images with preinstalled modules
run: |
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml pull
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --no-start
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml pull
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --no-start
- name: Analyze PR
run: |
# Get list of installed modules
ODOO_BASE_MODULES=$(docker inspect \
--format '{{ index .Config.Labels "dinar.odoo.modules"}}' \
dinar_odoo_1)
dinar-odoo-1)
echo "ODOO_BASE_MODULES=$ODOO_BASE_MODULES"
# sets environment variables that available in next steps via $ {{ env.PR_... }} notation
Expand All @@ -145,8 +145,8 @@ jobs:
# Install new dependencies without tests
export MODULES="${{ env.PR_MODULES_DEPS }}"
export LOAD_MODULES="${{ env.PR_MODULES_LOAD }}"
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --abort-on-container-exit
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --abort-on-container-exit
- name: Install Additional Dependencies (Packages)
if: env.PR_DEPS != ''
run: |
Expand Down Expand Up @@ -187,8 +187,8 @@ jobs:
export MODULES="${{ env.PR_MODULES }}"
export LOAD_MODULES="${{ env.PR_MODULES_LOAD }}"
export ODOO_EXTRA_ARG=--test-enable
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --abort-on-container-exit
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --abort-on-container-exit
tests-all:
name: Integration Tests
Expand Down Expand Up @@ -248,9 +248,9 @@ jobs:
bash DINAR/workflow-files/how-to-run-locally.sh ${{ secrets.GITHUB_TOKEN }}
- name: Download base images
run: |
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml pull
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --no-start
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml pull
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --no-start
- name: Apply new-deps artifact
if: env.ARTIFACT != 'empty'
run: |
Expand All @@ -260,5 +260,5 @@ jobs:
export MODULES="${{ env.ALL_MODULES }}"
export LOAD_MODULES="${{ env.ALL_MODULES_LOAD }}"
export ODOO_EXTRA_ARG=--test-enable
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker-compose -p DINAR -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --abort-on-container-exit
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml config
docker compose -p dinar -f DINAR/workflow-files/docker-compose-DINAR-pr.yml up --abort-on-container-exit
8 changes: 4 additions & 4 deletions .github/workflows/DINAR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ jobs:
- check-branch
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: REPO
- name: Checkout DINAR
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: DINAR
repository: itpp-labs/DINAR-fork
ref: master
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: "3.7.x"
python-version: "3.10"
- name: Prepare build folder
run: |
cp -rnT DINAR/embedded-files/ REPO/
Expand Down
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
[![[email protected]](https://itpp.dev/images/infinity-readme.png)](mailto:[email protected])
# [17.0] Odoo Integration Modules
<h1 align="center">¡Welcome!</h1>

:open_file_folder: Get a **.zip** file with all needed dependencies:
<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>

<div align="center">
<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>
</div>

<p align="center"><em>Click the image for a quick introduction.</em></p>

# Is It Magic?

:star: Star this repo if you **like** it!

Other Addons
============

| Repository | Versions |
|------------|----------|
| [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) |
| [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) |
| [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) |
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.
98 changes: 98 additions & 0 deletions sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.. image:: https://itpp.dev/images/infinity-readme.png
:alt: Tested and maintained by IT Projects Labs
:target: https://odoomagic.com

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://opensource.org/licenses/MIT
:alt: License: MIT

=============
Sync Studio
=============

Synchronize something with anything:

* System X ↔ Odoo
* Odoo 1 ↔ Odoo 2
* System X ↔ System Y

Provides a single place to handle synchronization trigered by one of the following events:

* **Cron** -- provided by ``ir.cron``
* **DB Event** -- provided by ``base.automation``
* **Incoming webhook** -- modified version of ``/website/action`` controller from ``website`` module
* **Manual Triggering** -- provided by ``ir.actions.server``. User needs to click a button to run this action

Difference with built-in code evaluation:

* Allows to use json format for incomming webhooks
* Provides helpers for resource linking. See *Links* section in `<doc/index.rst>`__
* Uses queue_job module as a job broker
* Asynchronous calls to split big task into few small ones
* Allows repeat job on temporary fails (e.g. when external API is not available)

Roadmap
=======

* Code widget: show line numbers
* Webhooks: add a possibility to retry failed webhook (e.g. to debug code)
* 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

Developer Hints
===============

Public webhook address
----------------------

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``.

SSH tunneling
~~~~~~~~~~~~~

* Connect your server:

* Edit file ``/etc/ssh/sshd_config``:

* Find ``GatewayPorts`` attribute and set value to ``yes``

* Restart ssh daemon::

service ssh restart

* Connect to your server with ``-R`` attribute::

ssh [email protected] -R 0.0.0.0:8069:localhost:8069

Now you can use ``http://yourserver.example:8069`` as a value for ``web.base.url`` in Odoo.

Few more steps requires to use https connection (e.g. telegram api works with https only). In your server do as following:

* Install nginx in your server
* Add nginx config::

server {
listen 80;
server_name yourserver.example;
location / {
proxy_set_header Host $host;
proxy_pass http://localhost:8069;
}
}

* Install `certbot <https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx.html>`__
* Run
::

sudo certbot --nginx

* Done!

Questions?
==========

To get an assistance on this module contact us by email :arrow_right: [email protected]

Further information
===================

Tested on `Odoo 16.0 <https://github.com/odoo/odoo/commit/6565502494aa1c00104beb59698e359b8769553f>`__
6 changes: 6 additions & 0 deletions sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# License MIT (https://opensource.org/licenses/MIT).

from . import models
from . import controllers
from . import lib
from . import tools
52 changes: 52 additions & 0 deletions sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2020-2021,2024-2025 Ivan Yelizariev <https://twitter.com/yelizariev>
# Copyright 2020-2021 Denis Mudarisov <https://github.com/trojikman>
# Copyright 2021 Ilya Ilchenko <https://github.com/mentalko>
# License MIT (https://opensource.org/licenses/MIT).

{
"name": "Sync 🪬 Studio",
"summary": """Join the Amazing 😍 Community ⤵️""",
"category": "VooDoo ✨ Magic",
"version": "17.0.13.0.1",
"application": True,
"author": "Ivan Yelizariev",
"support": "[email protected]",
"website": "https://sync_studio.t.me/",
"license": "Other OSI approved licence", # MIT
# The `partner_telegram` dependency is not directly needed,
# but it plays an important role in the **Sync 🪬 Studio** ecosystem
# and is added for the quick onboarding of new **Cyber ✨ Pirates**.
"depends": ["base_automation", "mail", "queue_job", "partner_telegram"],
"external_dependencies": {"python": ["markdown", "pyyaml"], "bin": []},
"data": [
"security/sync_groups.xml",
"security/ir.model.access.csv",
"views/sync_menus.xml",
"views/ir_logging_views.xml",
"views/sync_job_views.xml",
"views/sync_trigger_cron_views.xml",
"views/sync_trigger_automation_views.xml",
"views/sync_trigger_webhook_views.xml",
"views/sync_trigger_button_views.xml",
"views/sync_order_views.xml",
"views/sync_task_views.xml",
"views/sync_link_views.xml",
"views/sync_project_views.xml",
"data/queue_job_function_data.xml",
],
"assets": {
"web.assets_backend": [
"sync/static/src/scss/src.scss",
],
},
"demo": [
"data/sync_project_unittest_demo.xml",
],
"qweb": [],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"uninstall_hook": None,
"auto_install": False,
"installable": True,
}
3 changes: 3 additions & 0 deletions sync/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License MIT (https://opensource.org/licenses/MIT).

from . import webhook
36 changes: 36 additions & 0 deletions sync/controllers/webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2020 Ivan Yelizariev <https://twitter.com/yelizariev>
# Copyright 2021 Denis Mudarisov <https://github.com/trojikman>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import http

from ..lib.controllers.main import Website


class Webhook(Website):
@http.route(
[
"/website/action-json/<path_or_xml_id_or_id>",
"/website/action-json/<path_or_xml_id_or_id>/<path:path>",
],
type="json",
auth="public",
website=True,
csrf=False,
)
def actions_server_json(self, path_or_xml_id_or_id, **post):
res = self.actions_server(path_or_xml_id_or_id, **post)
return res.data

@http.route(
[
"/website/action-http/<path_or_xml_id_or_id>",
"/website/action-http/<path_or_xml_id_or_id>/<path:path>",
],
type="http",
auth="public",
website=True,
csrf=False,
)
def actions_server_http(self, path_or_xml_id_or_id, **post):
return self.actions_server(path_or_xml_id_or_id, **post)
13 changes: 13 additions & 0 deletions sync/data/queue_job_function_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2020 Ivan Yelizariev <https://twitter.com/yelizariev>
License MIT (https://opensource.org/licenses/MIT). -->
<odoo>
<record id="queue_job_function_task_run" model="queue.job.function">
<field name="model_id" ref="sync.model_sync_task" />
<field name="method">run</field>
<field
name="retry_pattern"
eval="{1: 5 * 60, 2: 15 * 60, 3: 60 * 60, 4: 3 * 60 * 60}"
/>
</record>
</odoo>
25 changes: 25 additions & 0 deletions sync/data/sync_project_context_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="sync_project_context_odoo2odoo_demo" model="sync.project.context">
<field name="name">odoo2odoo_demo</field>
<field name="display_name">Odoo2odoo (Demo)</field>
</record>
<record id="sync_project_context_telegram_demo" model="sync.project.context">
<field name="name">telegram_demo</field>
<field name="display_name">Telegram (Demo)</field>
</record>
<record id="sync_project_context_trello_demo" model="sync.project.context">
<field name="name">trello</field>
<field name="display_name">Trello (Demo)</field>
</record>
<record id="sync_project_context_github_demo" model="sync.project.context">
<field name="name">github</field>
<field name="display_name">Github (Demo)</field>
</record>
<record id="sync_project_context_math_demo" model="sync.project.context">
<field name="name">math</field>
<field name="display_name">Math functions (Demo)</field>
</record>
</data>
</odoo>
Loading

0 comments on commit 2ab02dc

Please sign in to comment.