Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
126 changes: 126 additions & 0 deletions edi_component_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
Edi Connector Oca
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3bf081843ed5a121210f466d0a354fe495798e66f75d76f6958176548d647356
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/19.0/edi_component_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-19-0/edi-framework-19-0-edi_component_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=19.0
:alt: Try me on Runboat

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

This module allows to use components to handle code to execute on EDI
Exchanges.

**Table of contents**

.. contents::
:local:

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

Component definition
--------------------

The component used on edi must inherit from:

- ``edi.component.input.mixin`` for processing and implement the
process function
- ``edi.component.receive.mixin`` for reception and implement the
receive function
- ``edi.component.output.mixin`` for generation and implement the
generate function
- ``edi.component.send.mixin`` for sending and implement the send
function
- ``edi.component.check.mixin`` for checking and implement the check
function
- ``edi.component.validate.mixin`` for validation and implement the
validate function

Also, the components may have the following elements that will be used
to use the right component:

- ``_backend_type``: code of the backend type
- ``_exchange_type``: code of the exchange type
- ``_usage``: Automatically set by the inherited component

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_component_oca%0Aversion:%2019.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
-------

* ACSONE
* Dixmit
* Camptocamp

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

- Simone Orsi <simahawk@gmail.com>
- Enric Tobella <enric.tobella@dixmit.com>
- Manuel Regidor <manuel.regidor@sygel.es>
- Thien Vo <thienvh@trobz.com>
- Jordi Masvidal <jordi.masvidal@forgeflow.com>

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.

.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px
:target: https://github.com/simahawk
:alt: simahawk
.. |maintainer-etobella| image:: https://github.com/etobella.png?size=40px
:target: https://github.com/etobella
:alt: etobella

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-simahawk| |maintainer-etobella|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions edi_component_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import components
from . import models
15 changes: 15 additions & 0 deletions edi_component_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2025 Dixmit
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

{
"name": "Edi Connector Oca",
"summary": """Allow to use Connector as a source in EDI""",
"version": "19.0.1.0.0",
"license": "LGPL-3",
"author": "ACSONE,Dixmit,Camptocamp,Odoo Community Association (OCA)",
"maintainers": ["simahawk", "etobella"],
"website": "https://github.com/OCA/edi-framework",
"depends": ["base_edi", "component_event", "edi_core_oca"],
"data": [],
"demo": [],
}
4 changes: 4 additions & 0 deletions edi_component_oca/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import base
from . import base_output
from . import base_input
from . import base_validate
72 changes: 72 additions & 0 deletions edi_component_oca/components/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2020 ACSONE
# @author: Simone Orsi <simahawk@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.component.core import AbstractComponent


class EDIBackendComponentMixin(AbstractComponent):
"""Generic mixin for all EDI components."""

_name = "edi.component.base.mixin"
_collection = "edi.backend"
_usage = None
_backend_type = None
_exchange_type = None

def __init__(self, work_context):
super().__init__(work_context)
self.backend = work_context.backend

@staticmethod
def _match_attrs():
"""Attributes to be used for matching this component.

By default, match by backend and exchange type.

NOTE: the class attribute must have an underscore, the name here not.
"""
return ("backend_type", "exchange_type")

@classmethod
def _component_match(cls, work, usage=None, model_name=None, **kw):
"""Override to customize match.

Registry lookup filtered by usage and model_name when landing here.
Now, narrow match to `_match_attrs` attributes.
"""
match_attrs = cls._match_attrs()
if not any([kw.get(k) for k in match_attrs]):
# No attr to check
return True

backend_type = kw.get("backend_type")
exchange_type = kw.get("exchange_type")

if cls._backend_type and cls._exchange_type:
# They must match both
return (
cls._backend_type == backend_type
and cls._exchange_type == exchange_type
)

if cls._backend_type not in (None, kw.get("backend_type")):
return False

if cls._exchange_type not in (None, kw.get("exchange_type")):
return False

return True


class EDIBackendRecordComponentMixin(AbstractComponent):
"""Generic mixin for record-bound components."""

_name = "edi.component.mixin"
_inherit = "edi.component.base.mixin"

def __init__(self, work_context):
super().__init__(work_context)
self.exchange_record = work_context.exchange_record
self.record = self.exchange_record.record
self.type_settings = self.exchange_record.type_id.get_settings()
23 changes: 23 additions & 0 deletions edi_component_oca/components/base_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2020 ACSONE
# @author: Simone Orsi <simahawk@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.component.core import AbstractComponent


class EDIBackendInputComponentMixin(AbstractComponent):
"""Generate input content."""

_name = "edi.component.input.mixin"
_inherit = "edi.component.mixin"

def process(self):
raise NotImplementedError()


class EDIBackendReceiveComponentMixin(AbstractComponent):
_name = "edi.component.receive.mixin"
_inherit = "edi.component.mixin"

def receive(self):
raise NotImplementedError()
36 changes: 36 additions & 0 deletions edi_component_oca/components/base_output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2020 ACSONE
# @author: Simone Orsi <simahawk@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.component.core import AbstractComponent


class EDIBackendOutputComponentMixin(AbstractComponent):
"""Generate output content."""

_name = "edi.component.output.mixin"
_inherit = "edi.component.mixin"
_usage = "edi.output.generate.*"

def generate(self):
raise NotImplementedError()


class EDIBackendSendComponentMixin(AbstractComponent):
"""Send output records."""

_name = "edi.component.send.mixin"
_inherit = "edi.component.mixin"
_usage = "edi.output.send.*"

def send(self):
raise NotImplementedError()


class EDIBackendCheckComponentMixin(AbstractComponent):
_name = "edi.component.check.mixin"
_inherit = "edi.component.mixin"
_usage = "edi.output.check.*"

def check(self):
raise NotImplementedError()
20 changes: 20 additions & 0 deletions edi_component_oca/components/base_validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 ACSONE
# @author: Simone Orsi <simahawk@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.component.core import AbstractComponent


class EDIBackendValidateComponentMixin(AbstractComponent):
"""Validate exchange data."""

_name = "edi.component.validate.mixin"
_inherit = "edi.component.mixin"
_usage = "edi.validate.*"

def validate(self, value=None):
self._validate(value)

def _validate(self, value=None):
"""Return None validated, raise `edi.exceptions.EDIValidationError` if not."""
raise NotImplementedError()
34 changes: 34 additions & 0 deletions edi_component_oca/i18n/edi_component_oca.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * edi_component_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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_component_oca
#: model:ir.model,name:edi_component_oca.model_edi_exchange_consumer_mixin
msgid "Abstract record where exchange records can be assigned"
msgstr ""

#. module: edi_component_oca
#: model:ir.model,name:edi_component_oca.model_edi_oca_component_handler
msgid "Component Handler for EDI"
msgstr ""

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

#. module: edi_component_oca
#: model:ir.model,name:edi_component_oca.model_edi_exchange_record
msgid "EDI exchange Record"
msgstr ""
37 changes: 37 additions & 0 deletions edi_component_oca/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * edi_component_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-10-14 06:34+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.10.4\n"

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

#. module: edi_component_oca
#: model:ir.model,name:edi_component_oca.model_edi_oca_component_handler
msgid "Component Handler for EDI"
msgstr "Gestore componente per EDI"

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

#. module: edi_component_oca
#: model:ir.model,name:edi_component_oca.model_edi_exchange_record
msgid "EDI exchange Record"
msgstr "Record di scambio EDI"
4 changes: 4 additions & 0 deletions edi_component_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import edi_backend
from . import edi_exchange_record
from . import edi_exchange_consumer_mixin
from . import edi_oca_component_handler
Loading
Loading