Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ addon | version | maintainers | summary
[edi_account_core_oca](edi_account_core_oca/) | 18.0.1.1.1 | <a href='https://github.com/etobella'><img src='https://github.com/etobella.png' width='32' height='32' style='border-radius:50%;' alt='etobella'/></a> | Define EDI Configuration for Account Moves
[edi_account_oca](edi_account_oca/) | 18.0.1.1.1 | <a href='https://github.com/etobella'><img src='https://github.com/etobella.png' width='32' height='32' style='border-radius:50%;' alt='etobella'/></a> | Define some component listeners for Account Moves
[edi_component_oca](edi_component_oca/) | 18.0.1.1.0 | <a href='https://github.com/simahawk'><img src='https://github.com/simahawk.png' width='32' height='32' style='border-radius:50%;' alt='simahawk'/></a> <a href='https://github.com/etobella'><img src='https://github.com/etobella.png' width='32' height='32' style='border-radius:50%;' alt='etobella'/></a> | Allow to use Connector as a source in EDI
[edi_core_oca](edi_core_oca/) | 18.0.1.7.1 | <a href='https://github.com/simahawk'><img src='https://github.com/simahawk.png' width='32' height='32' style='border-radius:50%;' alt='simahawk'/></a> <a href='https://github.com/etobella'><img src='https://github.com/etobella.png' width='32' height='32' style='border-radius:50%;' alt='etobella'/></a> | Define backends, exchange types, exchange records, basic automation and views for handling EDI exchanges.
[edi_core_oca](edi_core_oca/) | 18.0.1.7.2 | <a href='https://github.com/simahawk'><img src='https://github.com/simahawk.png' width='32' height='32' style='border-radius:50%;' alt='simahawk'/></a> <a href='https://github.com/etobella'><img src='https://github.com/etobella.png' width='32' height='32' style='border-radius:50%;' alt='etobella'/></a> | Define backends, exchange types, exchange records, basic automation and views for handling EDI exchanges.
[edi_endpoint_oca](edi_endpoint_oca/) | 18.0.1.0.3 | | Base module allowing configuration of custom endpoints for EDI framework.
[edi_exchange_template_oca](edi_exchange_template_oca/) | 18.0.1.3.3 | <a href='https://github.com/simahawk'><img src='https://github.com/simahawk.png' width='32' height='32' style='border-radius:50%;' alt='simahawk'/></a> | Allows definition of exchanges via templates.
[edi_exchange_template_party_data](edi_exchange_template_party_data/) | 18.0.1.0.1 | <a href='https://github.com/simahawk'><img src='https://github.com/simahawk.png' width='32' height='32' style='border-radius:50%;' alt='simahawk'/></a> | Glue module between edi_exchange_template and edi_party_data
Expand Down
2 changes: 1 addition & 1 deletion edi_core_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ EDI
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:aa0c40a082ced3e5e5d376f0eaf4c3a4487421a5abc4c22a81665a279bddaad1
!! source digest: sha256:5e54bc58f7c88ff2eaac2207226e25488a4aa47b800e1cdc606f485cf0523830
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion edi_core_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Define backends, exchange types, exchange records,
basic automation and views for handling EDI exchanges.
""",
"version": "18.0.1.7.1",
"version": "18.0.1.7.2",
"website": "https://github.com/OCA/edi-framework",
"development_status": "Beta",
"license": "LGPL-3",
Expand Down
7 changes: 7 additions & 0 deletions edi_core_oca/i18n/edi_core_oca.pot
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ msgid ""
"* Custom: let devs handle a custom behavior with specific developments\n"
msgstr ""

#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_count
msgid "# Exchange Records"
msgstr ""

#. module: edi_core_oca
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_consumer_mixin_buttons
msgid "<span class=\"pe-4\"><i class=\"fa fa-retweet\"/> EDI actions</span>"
Expand Down Expand Up @@ -766,6 +771,7 @@ msgstr ""
#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_consumer_mixin__exchange_record_ids
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_related_record__exchange_record_id
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_ids
msgid "Exchange Record"
msgstr ""

Expand Down Expand Up @@ -908,6 +914,7 @@ msgstr ""
#: model:ir.actions.act_window,name:edi_core_oca.act_open_edi_exchange_record_view
#: model:ir.ui.menu,name:edi_core_oca.menu_edi_exchange_record_root
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_backend_view_form
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_type_view_form
msgid "Exchanges"
msgstr ""

Expand Down
7 changes: 7 additions & 0 deletions edi_core_oca/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ msgid ""
"* Custom: let devs handle a custom behavior with specific developments\n"
msgstr ""

#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_count
msgid "# Exchange Records"
msgstr ""

#. module: edi_core_oca
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_consumer_mixin_buttons
msgid "<span class=\"pe-4\"><i class=\"fa fa-retweet\"/> EDI actions</span>"
Expand Down Expand Up @@ -770,6 +775,7 @@ msgstr ""
#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_consumer_mixin__exchange_record_ids
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_related_record__exchange_record_id
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_ids
msgid "Exchange Record"
msgstr ""

Expand Down Expand Up @@ -912,6 +918,7 @@ msgstr ""
#: model:ir.actions.act_window,name:edi_core_oca.act_open_edi_exchange_record_view
#: model:ir.ui.menu,name:edi_core_oca.menu_edi_exchange_record_root
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_backend_view_form
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_type_view_form
msgid "Exchanges"
msgstr ""

Expand Down
7 changes: 7 additions & 0 deletions edi_core_oca/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ msgid ""
"* Custom: let devs handle a custom behavior with specific developments\n"
msgstr ""

#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_count
msgid "# Exchange Records"
msgstr ""

#. module: edi_core_oca
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_consumer_mixin_buttons
msgid "<span class=\"pe-4\"><i class=\"fa fa-retweet\"/> EDI actions</span>"
Expand Down Expand Up @@ -780,6 +785,7 @@ msgstr ""
#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_consumer_mixin__exchange_record_ids
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_related_record__exchange_record_id
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_ids
msgid "Exchange Record"
msgstr ""

Expand Down Expand Up @@ -923,6 +929,7 @@ msgstr ""
#: model:ir.actions.act_window,name:edi_core_oca.act_open_edi_exchange_record_view
#: model:ir.ui.menu,name:edi_core_oca.menu_edi_exchange_record_root
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_backend_view_form
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_type_view_form
msgid "Exchanges"
msgstr ""

Expand Down
9 changes: 8 additions & 1 deletion edi_core_oca/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-05-25 19:57+0000\n"
"PO-Revision-Date: 2026-05-29 13:46+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
Expand Down Expand Up @@ -154,6 +154,11 @@ msgstr ""
"* Personalizzato: consente agli sviluppatori di gestire un comportamento "
"personalizzato con sviluppo personalizzato\n"

#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_count
msgid "# Exchange Records"
msgstr "N° record scambio"

#. module: edi_core_oca
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_consumer_mixin_buttons
msgid "<span class=\"pe-4\"><i class=\"fa fa-retweet\"/> EDI actions</span>"
Expand Down Expand Up @@ -846,6 +851,7 @@ msgstr "Sequenza nome file scambio"
#. module: edi_core_oca
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_consumer_mixin__exchange_record_ids
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_related_record__exchange_record_id
#: model:ir.model.fields,field_description:edi_core_oca.field_edi_exchange_type__exchange_record_ids
msgid "Exchange Record"
msgstr "Record di scambio"

Expand Down Expand Up @@ -990,6 +996,7 @@ msgstr "Scambiato oggi"
#: model:ir.actions.act_window,name:edi_core_oca.act_open_edi_exchange_record_view
#: model:ir.ui.menu,name:edi_core_oca.menu_edi_exchange_record_root
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_backend_view_form
#: model_terms:ir.ui.view,arch_db:edi_core_oca.edi_exchange_type_view_form
msgid "Exchanges"
msgstr "Scambi"

Expand Down
32 changes: 32 additions & 0 deletions edi_core_oca/models/edi_exchange_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ class EDIExchangeType(models.Model):
""",
)
advanced_settings = Serialized(default={}, compute="_compute_advanced_settings")
exchange_record_ids = fields.One2many(
comodel_name="edi.exchange.record",
inverse_name="type_id",
)
exchange_record_count = fields.Integer(
string="# Exchange Records",
compute="_compute_exchange_record_count",
)
rule_ids = fields.One2many(
comodel_name="edi.exchange.type.rule",
inverse_name="type_id",
Expand Down Expand Up @@ -240,6 +248,17 @@ def _compute_ack_for_type_ids(self):
for rec in self:
rec.ack_for_type_ids = [x.id for x in by_type_id.get(rec.id, [])]

@api.depends("exchange_record_ids")
def _compute_exchange_record_count(self):
data = self.env["edi.exchange.record"]._read_group(
[("type_id", "in", self.ids)],
groupby=["type_id"],
aggregates=["__count"],
)
mapped_data = {type_.id: count for type_, count in data}
for rec in self:
rec.exchange_record_count = mapped_data.get(rec.id, 0)

def get_settings(self):
return self.advanced_settings

Expand Down Expand Up @@ -331,3 +350,16 @@ def copy_data(self, default=None):
default = dict(default or {})
default.setdefault("code", f"{self.code}/COPY_FIXME")
return super().copy_data(default=default)

def action_view_exchange_records(self):
self.ensure_one()
action = self.env["ir.actions.act_window"]._for_xml_id(
"edi_core_oca.act_open_edi_exchange_record_view"
)
action["domain"] = [("type_id", "=", self.id)]
action["context"] = {
"default_type_id": self.id,
"default_backend_id": self.backend_id.id,
"search_default_type_id": self.id,
}
return action
2 changes: 1 addition & 1 deletion edi_core_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h1>EDI</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:aa0c40a082ced3e5e5d376f0eaf4c3a4487421a5abc4c22a81665a279bddaad1
!! source digest: sha256:5e54bc58f7c88ff2eaac2207226e25488a4aa47b800e1cdc606f485cf0523830
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/edi-framework/tree/18.0/edi_core_oca"><img alt="OCA/edi-framework" src="https://img.shields.io/badge/github-OCA%2Fedi--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/edi-framework-18-0/edi-framework-18-0-edi_core_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/edi-framework&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Base EDI backend.</p>
Expand Down
37 changes: 37 additions & 0 deletions edi_core_oca/tests/test_exchange_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,40 @@ def test_archive_rules(self):
rule2.invalidate_recordset()
self.assertFalse(rule1.active)
self.assertFalse(rule2.active)

def _create_exchange_record(self, exc_type):
return self.backend.create_record(
exc_type.code,
{"model": self.partner._name, "res_id": self.partner.id},
)

def test_exchange_record_count(self):
exc_type = self.exchange_type_out
self.assertEqual(exc_type.exchange_record_count, 0)
rec1 = self._create_exchange_record(exc_type)
rec2 = self._create_exchange_record(exc_type)
# Record on a different type must not be counted
self._create_exchange_record(self.exchange_type_in)
self.assertEqual(exc_type.exchange_record_count, 2)
self.assertEqual(set(exc_type.exchange_record_ids.ids), {rec1.id, rec2.id})

def test_action_view_exchange_records(self):
exc_type = self.exchange_type_out
rec = self._create_exchange_record(exc_type)
action = exc_type.action_view_exchange_records()
self.assertEqual(action["type"], "ir.actions.act_window")
self.assertEqual(action["res_model"], "edi.exchange.record")
self.assertIn(("type_id", "=", exc_type.id), action["domain"])
ctx = action["context"]
self.assertEqual(ctx.get("default_type_id"), exc_type.id)
self.assertEqual(ctx.get("default_backend_id"), exc_type.backend_id.id)
self.assertEqual(ctx.get("search_default_type_id"), exc_type.id)
# The action's domain must actually match the created exchange record
records = self.env[action["res_model"]].search(action["domain"])
self.assertIn(rec, records)

def test_action_view_exchange_records_requires_singleton(self):
with self.assertRaises(ValueError):
(
self.exchange_type_out | self.exchange_type_in
).action_view_exchange_records()
14 changes: 14 additions & 0 deletions edi_core_oca/views/edi_exchange_type_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
bg_color="bg-danger"
invisible="active"
/>
<div class="oe_button_box" name="button_box">
<button
class="oe_stat_button"
type="object"
name="action_view_exchange_records"
icon="fa-exchange"
>
<field
name="exchange_record_count"
widget="statinfo"
string="Exchanges"
/>
</button>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
Expand Down
7 changes: 7 additions & 0 deletions edi_oca/i18n/edi_oca.pot
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ msgid ""
"* Custom: let devs handle a custom behavior with specific developments\n"
msgstr ""

#. module: edi_oca
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_type__exchange_record_count
msgid "# Exchange Records"
msgstr ""

#. module: edi_oca
#: model_terms:ir.ui.view,arch_db:edi_oca.edi_exchange_consumer_mixin_buttons
msgid "<span class=\"pe-4\"><i class=\"fa fa-retweet\"/> EDI actions</span>"
Expand Down Expand Up @@ -710,6 +715,7 @@ msgstr ""
#. module: edi_oca
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_consumer_mixin__exchange_record_ids
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_related_record__exchange_record_id
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_type__exchange_record_ids
msgid "Exchange Record"
msgstr ""

Expand Down Expand Up @@ -785,6 +791,7 @@ msgstr ""
#: model:ir.actions.act_window,name:edi_oca.act_open_edi_exchange_record_view
#: model:ir.ui.menu,name:edi_oca.menu_edi_exchange_record_root
#: model_terms:ir.ui.view,arch_db:edi_oca.edi_backend_view_form
#: model_terms:ir.ui.view,arch_db:edi_oca.edi_exchange_type_view_form
msgid "Exchanges"
msgstr ""

Expand Down
9 changes: 8 additions & 1 deletion edi_oca/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-05-26 08:46+0000\n"
"PO-Revision-Date: 2026-05-29 13:46+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
Expand Down Expand Up @@ -153,6 +153,11 @@ msgstr ""
"* Personalizzato: consente agli sviluppatori di gestire un comportamento "
"personalizzato con sviluppo personalizzato\n"

#. module: edi_oca
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_type__exchange_record_count
msgid "# Exchange Records"
msgstr "N° record scambio"

#. module: edi_oca
#: model_terms:ir.ui.view,arch_db:edi_oca.edi_exchange_consumer_mixin_buttons
msgid "<span class=\"pe-4\"><i class=\"fa fa-retweet\"/> EDI actions</span>"
Expand Down Expand Up @@ -786,6 +791,7 @@ msgstr "Sequenza nome file scambio"
#. module: edi_oca
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_consumer_mixin__exchange_record_ids
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_related_record__exchange_record_id
#: model:ir.model.fields,field_description:edi_oca.field_edi_exchange_type__exchange_record_ids
msgid "Exchange Record"
msgstr "Record di scambio"

Expand Down Expand Up @@ -861,6 +867,7 @@ msgstr "Scambiato oggi"
#: model:ir.actions.act_window,name:edi_oca.act_open_edi_exchange_record_view
#: model:ir.ui.menu,name:edi_oca.menu_edi_exchange_record_root
#: model_terms:ir.ui.view,arch_db:edi_oca.edi_backend_view_form
#: model_terms:ir.ui.view,arch_db:edi_oca.edi_exchange_type_view_form
msgid "Exchanges"
msgstr "Scambi"

Expand Down
Loading
Loading