Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] edi_endpoint_oca #130

Merged
merged 51 commits into from
Mar 14, 2025
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2b6c667
Add edi_endpoint_oca
simahawk Sep 15, 2021
82b57f2
[UPD] Update edi_endpoint_oca.pot
oca-travis Nov 2, 2021
b7d6171
[UPD] README.rst
OCA-git-bot Nov 2, 2021
e55ca21
[ADD] icon.png
OCA-git-bot Nov 2, 2021
f8cd57a
edi_endpoint_oca 14.0.1.1.0
OCA-git-bot Nov 2, 2021
e256b0e
edi_endpoint: fix load demo data
simahawk Nov 10, 2021
a793713
edi_endpoint_oca 14.0.1.1.1
OCA-git-bot Nov 11, 2021
85c4ff4
edi_endpoint: improve search/tree views
simahawk Nov 12, 2021
676959a
edi_endpoint_oca: fix manage endpoints action domain
simahawk Dec 28, 2021
d333526
[UPD] Update edi_endpoint_oca.pot
Jan 12, 2022
0d6f7c3
edi_endpoint_oca 14.0.1.2.0
OCA-git-bot Jan 12, 2022
61c5b2a
Misc fix of authorship name
simahawk Jan 14, 2022
6093c2d
edi_endpoint_oca 14.0.1.2.1
OCA-git-bot Jan 14, 2022
d59a460
[FIX] Fix access right issues when using actions
sebalix Jan 31, 2022
34244d1
edi_endpoint_oca 14.0.1.2.2
OCA-git-bot Jan 31, 2022
9ce154e
[UPD] Update edi_endpoint_oca.pot
Aug 1, 2022
c795416
edi_endpoint: prevent backend archive
simahawk Aug 12, 2022
56509a4
edi_endpoint: improve endpoint count
simahawk Aug 12, 2022
4053921
edi_endpoint: temp fix for tests
simahawk Aug 12, 2022
98f1f19
[UPD] Update edi_endpoint_oca.pot
Aug 17, 2022
dddebf8
edi_endpoint_oca 14.0.1.3.0
OCA-git-bot Aug 17, 2022
ae878f8
[UPD] Update edi_endpoint_oca.pot
May 16, 2023
2888a96
edi_endpoint: integrate e_route_handler xworker fix
simahawk Jun 15, 2022
3f898ba
edi_endpoint: trash custom controller
simahawk Apr 21, 2023
e6cf0b0
[UPD] Update edi_endpoint_oca.pot
May 17, 2023
3bb9d92
edi_endpoint: dev status = Beta
simahawk Jun 1, 2023
9664047
edi_endpoint: track endpoint on exchange record
simahawk May 29, 2023
6203e62
[UPD] Update edi_endpoint_oca.pot
Jun 1, 2023
a9de95b
[UPD] README.rst
OCA-git-bot Jun 1, 2023
e034b35
edi_endpoint_oca 14.0.1.5.0
OCA-git-bot Jun 1, 2023
e8bc2e8
edi_endpoint_oca: Migration to 16.0
JordiBForgeFlow Jun 9, 2023
05cb699
edi_endpoint: make pre-commit happy
simahawk Dec 18, 2023
05d5ed5
[UPD] Update edi_endpoint_oca.pot
Feb 4, 2024
d0da57e
[BOT] post-merge updates
OCA-git-bot Feb 4, 2024
2d92a5f
Added translation using Weblate (Italian)
mymage May 13, 2024
1abee15
[IMP] edi_endpoint_oca: endpoint multi-company rule
JordiMForgeFlow Jun 5, 2024
899565a
[UPD] Update edi_endpoint_oca.pot
Jul 9, 2024
9327d3c
Update translation files
weblate Jul 9, 2024
6fe79d5
edi_endpoint: fix form view inheritance
simahawk Jul 23, 2024
f994689
[BOT] post-merge updates
OCA-git-bot Jul 26, 2024
f070d8a
Translated using Weblate (Italian)
mymage Jul 29, 2024
cb673eb
Translated using Weblate (Italian)
mymage Nov 15, 2024
3b6fecd
[BOT] post-merge updates
OCA-git-bot Nov 29, 2024
5184481
[IMP] edi_endpoint_oca: pre-commit auto fixes
SilvioC2C Dec 3, 2024
41ca9ba
[MIG] edi_endpoint_oca: Migration to 17.0
SilvioC2C Dec 3, 2024
d3b275e
[UPD] Update edi_endpoint_oca.pot
Dec 4, 2024
0f93644
[BOT] post-merge updates
OCA-git-bot Dec 4, 2024
6787d46
[IMP] edi_endpoint_oca: pre-commit stuff
JordiMForgeFlow Dec 17, 2024
01ccdf8
[MIG] edi_endpoint_oca: Migration to V18
JordiMForgeFlow Dec 17, 2024
fff8ab6
edi_endpoint: extend mixin views
simahawk Jan 23, 2025
4535120
[IMP] edi_endpoint_oca: don't filter for registry sync
JordiMForgeFlow Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions edi_endpoint_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
============
EDI endpoint
============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:39a9fa05388cca05495e879b7333c5ea61d8c2fcb2a50ae94797e2c16eb9a4e9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi--framework-lightgray.png?logo=github
:target: https://github.com/OCA/edi-framework/tree/18.0/edi_endpoint_oca
:alt: OCA/edi-framework
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-framework-18-0/edi-framework-18-0-edi_endpoint_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi-framework&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Base module allowing configuration of custom endpoints for EDI
framework.

**Table of contents**

.. contents::
:local:

Configuration
=============

Go to "EDI -> Config -> Endpoints".

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi-framework/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/edi-framework/issues/new?body=module:%20edi_endpoint_oca%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Simone Orsi <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/edi-framework <https://github.com/OCA/edi-framework/tree/18.0/edi_endpoint_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions edi_endpoint_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions edi_endpoint_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "EDI endpoint",
"summary": """
Base module allowing configuration of custom endpoints for EDI framework.
""",
"version": "18.0.1.0.0",
"development_status": "Beta",
"license": "LGPL-3",
"website": "https://github.com/OCA/edi-framework",
"author": "Camptocamp,Odoo Community Association (OCA)",
"depends": ["base_edi", "edi_oca", "endpoint"],
"data": [
"data/server_action.xml",
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/edi_backend_views.xml",
"views/edi_endpoint_views.xml",
"views/edi_exchange_record_views.xml",
],
"demo": ["demo/edi_backend_demo.xml"],
}
12 changes: 12 additions & 0 deletions edi_endpoint_oca/data/server_action.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="server_action_registry_sync" model="ir.actions.server">
<field name="name">Sync registry</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="edi_endpoint_oca.model_edi_endpoint" />
<field name="binding_model_id" ref="edi_endpoint_oca.model_edi_endpoint" />
<field name="state">code</field>
<field name="code">records.write({"registry_sync": True})
</field>
</record>
</odoo>
29 changes: 29 additions & 0 deletions edi_endpoint_oca/demo/edi_backend_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="edi_backend_demo" model="edi.backend">
<field name="name">EDI backend with endpoints DEMO</field>
<field name="backend_type_id" ref="edi_oca.demo_edi_backend_type" />
</record>

<record id="edi_exchange_type_demo" model="edi.exchange.type">
<field name="name">EDI exchange demo </field>
<field name="code">demo_endpoint</field>
<field name="backend_type_id" ref="edi_oca.demo_edi_backend_type" />
<field name="direction">input</field>
</record>

<record id="edi_endpoint_demo_1" model="edi.endpoint">
<field name="backend_id" ref="edi_backend_demo" />
<field name="backend_type_id" ref="edi_oca.demo_edi_backend_type" />
<field name="exchange_type_id" ref="edi_exchange_type_demo" />
<field name="name">EDI Demo Endpoint 1</field>
<!-- The prefix `/edi/` will be added automatically -->
<field name="route">/demo/try</field>
<field name="request_method">GET</field>
<field name="exec_mode">code</field>
<field name="code_snippet">
record = endpoint.create_exchange_record()
result = {"response": Response("Created record: %s" % record.identifier)}
</field>
</record>
</odoo>
284 changes: 284 additions & 0 deletions edi_endpoint_oca/i18n/edi_endpoint_oca.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * edi_endpoint_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_form_view
msgid "<span class=\"o_stat_text\">Exchanges</span>"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_exchange_consumer_mixin
msgid "Abstract record where exchange records can be assigned"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__active
msgid "Active"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__auth_type
msgid "Auth Type"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__backend_id
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Backend"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__backend_type_id
msgid "Backend Type"
msgstr ""

#. module: edi_endpoint_oca
#. odoo-python
#: code:addons/edi_endpoint_oca/models/edi_endpoint.py:0
#, python-format
msgid "Backend and exchange type are mandatory"
msgstr ""

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Backend type"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__code_snippet
msgid "Code Snippet"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__code_snippet_docs
msgid "Code Snippet Docs"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__company_id
msgid "Company"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__create_uid
msgid "Created by"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__create_date
msgid "Created on"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__csrf
msgid "Csrf"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__display_name
msgid "Display Name"
msgstr ""

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_form_view
msgid "EDI"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_backend
msgid "EDI Backend"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_backend_type
msgid "EDI Backend Type"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_endpoint
msgid "EDI Endpoint"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.actions.act_window,name:edi_endpoint_oca.edi_endpoint_act_window
#: model:ir.ui.menu,name:edi_endpoint_oca.edi_endpoint_menu
msgid "EDI Endpoints"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_exchange_record
msgid "EDI exchange Record"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_exchange_consumer_mixin__origin_edi_endpoint_id
msgid "EDI origin endpoint"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_exchange_record__edi_endpoint_id
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_exchange_record_view_search
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_exchange_record_view_tree
msgid "Endpoint"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__endpoint_hash
msgid "Endpoint Hash"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_backend__endpoint_ids
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_backend_type__endpoint_ids
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_backend_view_form
msgid "Endpoints"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_backend__endpoints_count
msgid "Endpoints Count"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__exchange_type_id
msgid "Exchange Type"
msgstr ""

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Exchange type"
msgstr ""

#. module: edi_endpoint_oca
#. odoo-python
#: code:addons/edi_endpoint_oca/models/edi_endpoint.py:0
#, python-format
msgid "Exchange type not compatible with selected backend type."
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__exec_as_user_id
msgid "Exec As User"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__exec_mode
msgid "Exec Mode"
msgstr ""

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Group By"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__id
msgid "ID"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_endpoint__endpoint_hash
msgid "Identify the route with its main params"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__write_uid
msgid "Last Updated by"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__write_date
msgid "Last Updated on"
msgstr ""

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_backend_view_form
msgid "Manage endpoints"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__name
msgid "Name"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_endpoint__registry_sync
msgid ""
"ON: the record has been modified and registry was not notified.\n"
"No change will be active until this flag is set to false via proper action.\n"
"\n"
"OFF: record in line with the registry, nothing to do."
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_exchange_consumer_mixin__origin_edi_endpoint_id
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_exchange_record__edi_endpoint_id
msgid "Record generated via this endpoint"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__registry_sync
msgid "Registry Sync"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__request_content_type
msgid "Request Content Type"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__request_method
msgid "Request Method"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__route
msgid "Route"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__route_group
msgid "Route Group"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__route_type
msgid "Route Type"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.actions.server,name:edi_endpoint_oca.server_action_registry_sync
msgid "Sync registry"
msgstr ""

#. module: edi_endpoint_oca
#. odoo-python
#: code:addons/edi_endpoint_oca/models/edi_backend.py:0
#, python-format
msgid ""
"The following backend(s) have endpoints attached. Please archive them before:\n"
"\n"
"%s"
msgstr ""

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_endpoint__route_group
msgid "Use this to classify routes together"
msgstr ""

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_backend_view_form
msgid "endpoints configured"
msgstr ""
302 changes: 302 additions & 0 deletions edi_endpoint_oca/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * edi_endpoint_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-11-15 14:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_form_view
msgid "<span class=\"o_stat_text\">Exchanges</span>"
msgstr "<span class=\"o_stat_text\">Scambi</span>"

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_exchange_consumer_mixin
msgid "Abstract record where exchange records can be assigned"
msgstr "Record astratto dove i recod di scambio possono essere assegnati"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__active
msgid "Active"
msgstr "Attivo"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__auth_type
msgid "Auth Type"
msgstr "Tipo autorizzazione"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__backend_id
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Backend"
msgstr "Backend"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__backend_type_id
msgid "Backend Type"
msgstr "Tipo backend"

#. module: edi_endpoint_oca
#. odoo-python
#: code:addons/edi_endpoint_oca/models/edi_endpoint.py:0
#, python-format
msgid "Backend and exchange type are mandatory"
msgstr "Il backend e il tipo scambio sono obbligatori"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Backend type"
msgstr "Tipo backend"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__code_snippet
msgid "Code Snippet"
msgstr "Esempio codice"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__code_snippet_docs
msgid "Code Snippet Docs"
msgstr "Documenti esempio codice"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__company_id
msgid "Company"
msgstr "Azienda"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__create_uid
msgid "Created by"
msgstr "Creato da"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__create_date
msgid "Created on"
msgstr "Creato il"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__csrf
msgid "Csrf"
msgstr "CSRF"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_form_view
msgid "EDI"
msgstr "EDI"

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_backend
msgid "EDI Backend"
msgstr "Backend EDI"

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_backend_type
msgid "EDI Backend Type"
msgstr "Tipo backend EDI"

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_endpoint
msgid "EDI Endpoint"
msgstr "Endpoint EDI"

#. module: edi_endpoint_oca
#: model:ir.actions.act_window,name:edi_endpoint_oca.edi_endpoint_act_window
#: model:ir.ui.menu,name:edi_endpoint_oca.edi_endpoint_menu
msgid "EDI Endpoints"
msgstr "Endopoint EDI"

#. module: edi_endpoint_oca
#: model:ir.model,name:edi_endpoint_oca.model_edi_exchange_record
msgid "EDI exchange Record"
msgstr "Record di scambio EDI"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_exchange_consumer_mixin__origin_edi_endpoint_id
msgid "EDI origin endpoint"
msgstr "Endpoint origine EDI"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_exchange_record__edi_endpoint_id
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_exchange_record_view_search
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_exchange_record_view_tree
msgid "Endpoint"
msgstr "Endpoint"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__endpoint_hash
msgid "Endpoint Hash"
msgstr "Hash endpoint"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_backend__endpoint_ids
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_backend_type__endpoint_ids
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_backend_view_form
msgid "Endpoints"
msgstr "Endpoint"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_backend__endpoints_count
msgid "Endpoints Count"
msgstr "Conteggio endpoint"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__exchange_type_id
msgid "Exchange Type"
msgstr "Tipo scambio"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Exchange type"
msgstr "Tipo scambio"

#. module: edi_endpoint_oca
#. odoo-python
#: code:addons/edi_endpoint_oca/models/edi_endpoint.py:0
#, python-format
msgid "Exchange type not compatible with selected backend type."
msgstr "Tipo scambio non compatibile con il tipo backend selezionato."

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__exec_as_user_id
msgid "Exec As User"
msgstr "Esegui come utente"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__exec_mode
msgid "Exec Mode"
msgstr "Modo esecuzione"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_endpoint_search_view
msgid "Group By"
msgstr "Raggruppa per"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__id
msgid "ID"
msgstr "ID"

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_endpoint__endpoint_hash
msgid "Identify the route with its main params"
msgstr "Identifica la rotta con questi parametri principali"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__write_uid
msgid "Last Updated by"
msgstr "Ultimo aggiornamento di"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__write_date
msgid "Last Updated on"
msgstr "Ultimo aggiornamento il"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_backend_view_form
msgid "Manage endpoints"
msgstr "Gestione endpoint"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__name
msgid "Name"
msgstr "Nome"

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_endpoint__registry_sync
msgid ""
"ON: the record has been modified and registry was not notified.\n"
"No change will be active until this flag is set to false via proper action.\n"
"\n"
"OFF: record in line with the registry, nothing to do."
msgstr ""
"Acceso: il record è stato modificato e il registro non è stato notificato.\n"
"Nessuna modifica sarà attiva finchè questa opzione è impostata a falso "
"attraverso un'azione opportuna.\n"
"\n"
"Spento: record allineato con il registro, non c'è niente da fare."

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_exchange_consumer_mixin__origin_edi_endpoint_id
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_exchange_record__edi_endpoint_id
msgid "Record generated via this endpoint"
msgstr "Record generato attraverso questo endpoint"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__registry_sync
msgid "Registry Sync"
msgstr "Sincro registro"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__request_content_type
msgid "Request Content Type"
msgstr "Tipo contenuto richiesta"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__request_method
msgid "Request Method"
msgstr "Metodo richiesta"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__route
msgid "Route"
msgstr "Percorso"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__route_group
msgid "Route Group"
msgstr "Gruppo percorso"

#. module: edi_endpoint_oca
#: model:ir.model.fields,field_description:edi_endpoint_oca.field_edi_endpoint__route_type
msgid "Route Type"
msgstr "Tipo percorso"

#. module: edi_endpoint_oca
#: model:ir.actions.server,name:edi_endpoint_oca.server_action_registry_sync
msgid "Sync registry"
msgstr "Sincronizza registro"

#. module: edi_endpoint_oca
#. odoo-python
#: code:addons/edi_endpoint_oca/models/edi_backend.py:0
#, python-format
msgid ""
"The following backend(s) have endpoints attached. Please archive them "
"before:\n"
"\n"
"%s"
msgstr ""
"I seguenti backend hanno endpoints allegati. Devono essere prima archiviati:"
"\n"
"\n"
"%s"

#. module: edi_endpoint_oca
#: model:ir.model.fields,help:edi_endpoint_oca.field_edi_endpoint__route_group
msgid "Use this to classify routes together"
msgstr "Utilizzarlo per classificare i percorsi insieme"

#. module: edi_endpoint_oca
#: model_terms:ir.ui.view,arch_db:edi_endpoint_oca.edi_backend_view_form
msgid "endpoints configured"
msgstr "endopoint configurati"
5 changes: 5 additions & 0 deletions edi_endpoint_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import edi_backend
from . import edi_backend_type
from . import edi_endpoint
from . import edi_exchange_record
from . import edi_exchange_consumer_mixin
58 changes: 58 additions & 0 deletions edi_endpoint_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import _, api, exceptions, fields, models


class EDIBackend(models.Model):
_inherit = "edi.backend"

endpoint_ids = fields.One2many(
string="Endpoints",
comodel_name="edi.endpoint",
inverse_name="backend_id",
)
endpoints_count = fields.Integer(compute="_compute_endpoints_count")

@api.depends("endpoint_ids.active")
def _compute_endpoints_count(self):
data = self.env["edi.endpoint"].read_group(
[("backend_id", "in", self.ids), ("active", "=", True)],
["backend_id"],
["backend_id"],
)
by_backend_id = {x["backend_id"][0]: x["backend_id_count"] for x in data}
for record in self:
record.endpoints_count = by_backend_id.get(record.id)

def action_manage_endpoints(self):
xmlid = "edi_endpoint_oca.edi_endpoint_act_window"
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
action["domain"] = [

Check warning on line 32 in edi_endpoint_oca/models/edi_backend.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_backend.py#L30-L32

Added lines #L30 - L32 were not covered by tests
("backend_type_id", "=", self.backend_type_id.id),
"|",
("backend_id", "=", False),
("backend_id", "=", self.id),
]
action["context"] = {

Check warning on line 38 in edi_endpoint_oca/models/edi_backend.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_backend.py#L38

Added line #L38 was not covered by tests
"default_backend_id": self.id,
"default_backend_type_id": self.backend_type_id.id,
}
return action

Check warning on line 42 in edi_endpoint_oca/models/edi_backend.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_backend.py#L42

Added line #L42 was not covered by tests

@api.constrains("active")
def _check_archive(self):
to_check = [
x
for x in self
if not x.active and x.endpoint_ids.filtered(lambda x: x.active)
]
if to_check:
raise exceptions.UserError(self._check_archive_error_msg(to_check))

def _check_archive_error_msg(self, backends):
return _(
"The following backend(s) have endpoints attached. "
"Please archive them before:\n\n%s"
) % "\n- ".join([x.name for x in backends])
16 changes: 16 additions & 0 deletions edi_endpoint_oca/models/edi_backend_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


# TODO add view
class EDIBackendType(models.Model):
_inherit = "edi.backend.type"

endpoint_ids = fields.One2many(
string="Endpoints",
comodel_name="edi.endpoint",
inverse_name="backend_type_id",
)
88 changes: 88 additions & 0 deletions edi_endpoint_oca/models/edi_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import werkzeug

from odoo import _, api, exceptions, fields, models
from odoo.tools import safe_eval


class EDIEndpoint(models.Model):
"""EDI endpoint.
Manage endpoints used within EDI framework.
"""

_name = "edi.endpoint"
_inherit = ["endpoint.mixin"]
_description = "EDI Endpoint"

_endpoint_route_prefix = "/edi"

backend_type_id = fields.Many2one(
comodel_name="edi.backend.type",
required=True,
)
# Leave these as unrequired to allow pre-configuration of endpoints by backend type
backend_id = fields.Many2one(
comodel_name="edi.backend", domain="[('backend_type_id','=', backend_type_id)]"
)
exchange_type_id = fields.Many2one(
comodel_name="edi.exchange.type",
domain="[('backend_type_id','=', backend_type_id)]",
)

# TODO: add unit tests

def create_exchange_record(self, file_content=None, **vals):
"""Create an EDI exchange record from current endpoint.
Just a shortcut.
"""
self._check_endpoint_ready()
vals["edi_endpoint_id"] = self.id
rec = self.backend_id.create_record(self.exchange_type_id.code, vals)
if file_content:
rec._set_file_content(file_content)

Check warning on line 46 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L46

Added line #L46 was not covered by tests
return rec

def _check_endpoint_ready(self, request=False):
if not self.backend_id or not self.exchange_type_id:
msg = _("Backend and exchange type are mandatory")

Check warning on line 51 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L51

Added line #L51 was not covered by tests
if request:
self._logger.error(msg)
raise werkzeug.exceptions.BadRequest("Endpoint mis-configured")

Check warning on line 54 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L53-L54

Added lines #L53 - L54 were not covered by tests
else:
raise exceptions.UserError(msg)

Check warning on line 56 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L56

Added line #L56 was not covered by tests

@api.constrains("exchange_type_id", "backend_type_id")
def _check_backend_type(self):
for rec in self:
if (
rec.backend_type_id
and rec.exchange_type_id
and not rec.backend_type_id == rec.exchange_type_id.backend_type_id
):
raise exceptions.UserError(

Check warning on line 66 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L66

Added line #L66 was not covered by tests
_("Exchange type not compatible with selected backend type.")
)

def _handle_request(self, request):
self._check_endpoint_ready(request=True)
return super()._handle_request(request)

def action_view_edi_records(self):
self.ensure_one()
xmlid = "edi_oca.act_open_edi_exchange_record_view"
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
action["domain"] = [("edi_endpoint_id", "=", self.id)]

Check warning on line 78 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L75-L78

Added lines #L75 - L78 were not covered by tests
# Purge default search filters from ctx to avoid hiding records
ctx = action.get("context", {})

Check warning on line 80 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L80

Added line #L80 was not covered by tests
if isinstance(ctx, str):
ctx = safe_eval.safe_eval(ctx, self.env.context)
action["context"] = {

Check warning on line 83 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L82-L83

Added lines #L82 - L83 were not covered by tests
k: v for k, v in ctx.items() if not k.startswith("search_default_")
}
# Drop ID otherwise the context will be loaded from the action's record :S
action.pop("id")
return action

Check warning on line 88 in edi_endpoint_oca/models/edi_endpoint.py

Codecov / codecov/patch

edi_endpoint_oca/models/edi_endpoint.py#L87-L88

Added lines #L87 - L88 were not covered by tests
18 changes: 18 additions & 0 deletions edi_endpoint_oca/models/edi_exchange_consumer_mixin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 Camptocamp SA
# @author Simone Orsi <simahawk@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class EDIExchangeConsumerMixin(models.AbstractModel):
_inherit = "edi.exchange.consumer.mixin"

origin_edi_endpoint_id = fields.Many2one(
string="EDI origin endpoint",
comodel_name="edi.endpoint",
ondelete="set null",
related="origin_exchange_record_id.edi_endpoint_id",
# Store it to ease searching
store=True,
)
16 changes: 16 additions & 0 deletions edi_endpoint_oca/models/edi_exchange_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Camptocamp SA
# @author Simone Orsi <simahawk@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class EDIExchangeRecord(models.Model):
_inherit = "edi.exchange.record"

edi_endpoint_id = fields.Many2one(
comodel_name="edi.endpoint",
readonly=True,
string="Endpoint",
help="Record generated via this endpoint",
)
3 changes: 3 additions & 0 deletions edi_endpoint_oca/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions edi_endpoint_oca/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Go to "EDI -\> Config -\> Endpoints".
1 change: 1 addition & 0 deletions edi_endpoint_oca/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
2 changes: 2 additions & 0 deletions edi_endpoint_oca/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Base module allowing configuration of custom endpoints for EDI
framework.
2 changes: 2 additions & 0 deletions edi_endpoint_oca/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_edi_endpoint_edit,edi_endpoint edit,model_edi_endpoint,base_edi.group_edi_manager,1,1,1,1
11 changes: 11 additions & 0 deletions edi_endpoint_oca/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="edi_endpoint_multi_company_rule" model="ir.rule">
<field name="name">EDI Endpoint Multi-company</field>
<field name="model_id" ref="model_edi_endpoint" />
<field name="global" eval="True" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
</odoo>
Binary file added edi_endpoint_oca/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
429 changes: 429 additions & 0 deletions edi_endpoint_oca/static/description/index.html

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions edi_endpoint_oca/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import test_edi_endpoint
from . import test_edi_endpoint_controller
55 changes: 55 additions & 0 deletions edi_endpoint_oca/tests/test_edi_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import exceptions

from odoo.addons.endpoint.tests.common import CommonEndpoint


class TestEndpoint(CommonEndpoint):
@classmethod
def _setup_records(cls): # pylint: disable=missing-return
super()._setup_records()
cls.endpoint = cls.env.ref("edi_endpoint_oca.edi_endpoint_demo_1")

def test_endpoint_find(self):
self.assertEqual(
self.env["edi.endpoint"]._find_endpoint("/edi/demo/try"), self.endpoint
)

def test_exchange_record(self):
rec = self.endpoint.create_exchange_record()
self.assertEqual(rec.edi_endpoint_id, self.endpoint)

def test_route(self):
rec = self.endpoint.copy(
{
"route": "/noprefix",
}
)
self.assertEqual(rec.route, "/edi/noprefix")

def test_endpoint_count(self):
backend = self.endpoint.backend_id
self.assertEqual(backend.endpoints_count, 1)
rec = self.endpoint.copy(
{
"route": "/another",
}
)
self.assertEqual(backend.endpoints_count, 2)
rec.active = False
self.assertEqual(backend.endpoints_count, 1)

def test_archive_check(self):
backend = self.endpoint.backend_id
msg = r"The following backend\(s\) have endpoints attached*"
with self.assertRaisesRegex(exceptions.UserError, msg):
backend.active = False
backend.endpoint_ids.active = False
backend.active = False

def test_sync(self):
# FIXME: just testing if the method here is available on GH
self.endpoint._handle_registry_sync()
27 changes: 27 additions & 0 deletions edi_endpoint_oca/tests/test_edi_endpoint_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import os
import unittest

from odoo.tests.common import HttpCase


@unittest.skipIf(os.getenv("SKIP_HTTP_CASE"), "EDIEndpointHttpCase skipped")
class EDIEndpointHttpCase(HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
# force sync for demo records
cls.env["edi.endpoint"].search([])._handle_registry_sync()

def test_call1(self):
endpoint = "/edi/demo/try"
response = self.url_open(endpoint)
self.assertEqual(response.status_code, 401)
# Let's login now
self.authenticate("admin", "admin")
response = self.url_open(endpoint)
self.assertEqual(response.status_code, 200)
self.assertIn("Created record:", response.content.decode())
21 changes: 21 additions & 0 deletions edi_endpoint_oca/views/edi_backend_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="edi_backend_view_form" model="ir.ui.view">
<field name="model">edi.backend</field>
<field name="inherit_id" ref="edi_oca.edi_backend_view_form" />
<field name="arch" type="xml">
<notebook position="inside">
<page name="endpoints" string="Endpoints">
<div>
<field name="endpoints_count" /> endpoints configured
</div>
<button
type="object"
name="action_manage_endpoints"
string="Manage endpoints"
/>
</page>
</notebook>
</field>
</record>
</odoo>
99 changes: 99 additions & 0 deletions edi_endpoint_oca/views/edi_endpoint_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 Camptocamp SA
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<odoo>
<record model="ir.ui.view" id="edi_endpoint_form_view">
<field name="model">edi.endpoint</field>
<field name="inherit_id" ref="endpoint.endpoint_mixin_form_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('alert')]" position="before">
<div class="oe_button_box" name="button_box">
<button
type="object"
class="oe_stat_button"
icon="fa-retweet"
name="action_view_edi_records"
>
<div class="o_form_field o_stat_info">
<span class="o_stat_text">Exchanges</span>
</div>
</button>
</div>
</xpath>
<notebook position="before">
<separator string="EDI" />
<div name="backend">
<label for="backend_type_id" class="oe_edit_only" />
<field name="backend_type_id" class="oe_inline" />
</div>
<div name="backend_type">
<label for="backend_id" class="oe_edit_only" />
<field name="backend_id" class="oe_inline" required="1" />
</div>
<div name="exchange_type">
<label for="exchange_type_id" class="oe_edit_only" />
<field name="exchange_type_id" class="oe_inline" required="1" />
</div>
</notebook>
</field>
</record>

<record model="ir.ui.view" id="edi_endpoint_search_view">
<field name="model">edi.endpoint</field>
<field name="inherit_id" ref="endpoint.endpoint_mixin_search_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="exec_mode" position="after">
<field name="backend_id" />
<field name="backend_type_id" />
<field name="exchange_type_id" />
<group expand="0" string="Group By">
<filter
name="group_by_backend_type_id"
string="Backend type"
context="{'group_by': 'backend_type_id'}"
/>
<filter
name="group_by_backend_id"
string="Backend"
context="{'group_by': 'backend_id'}"
/>
<filter
name="group_by_exchange_type_id"
string="Exchange type"
context="{'group_by': 'exchange_type_id'}"
/>
</group>
</field>
</field>
</record>

<record model="ir.ui.view" id="edi_endpoint_tree_view">
<field name="model">edi.endpoint</field>
<field name="inherit_id" ref="endpoint.endpoint_mixin_list_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="exec_mode" position="after">
<field name="backend_id" />
<field name="backend_type_id" />
<field name="exchange_type_id" />
</field>
</field>
</record>

<record model="ir.actions.act_window" id="edi_endpoint_act_window">
<field name="name">EDI Endpoints</field>
<field name="res_model">edi.endpoint</field>
<field name="view_mode">list,form</field>
<field name="domain">[]</field>
<field name="context">{"search_default_all": 1}</field>
</record>

<record model="ir.ui.menu" id="edi_endpoint_menu">
<field name="name">EDI Endpoints</field>
<field name="parent_id" ref="edi_oca.menu_edi_config" />
<field name="action" ref="edi_endpoint_act_window" />
<field name="sequence" eval="100" />
</record>
</odoo>
32 changes: 32 additions & 0 deletions edi_endpoint_oca/views/edi_exchange_record_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="edi_exchange_record_view_form" model="ir.ui.view">
<field name="model">edi.exchange.record</field>
<field name="inherit_id" ref="edi_oca.edi_exchange_record_view_form" />
<field name="arch" type="xml">
<group name="status" position="inside">
<field name="edi_endpoint_id" />
</group>
</field>
</record>

<record id="edi_exchange_record_view_search" model="ir.ui.view">
<field name="model">edi.exchange.record</field>
<field name="inherit_id" ref="edi_oca.edi_exchange_record_view_search" />
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="edi_endpoint_id" string="Endpoint" />
</field>
</field>
</record>

<record id="edi_exchange_record_view_tree" model="ir.ui.view">
<field name="model">edi.exchange.record</field>
<field name="inherit_id" ref="edi_oca.edi_exchange_record_view_tree" />
<field name="arch" type="xml">
<field name="edi_exchange_state" position="after">
<field name="edi_endpoint_id" string="Endpoint" />
</field>
</field>
</record>
</odoo>