Skip to content

Commit

Permalink
[MIG] edi_oca: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
john-herholz-dt authored and simahawk committed Aug 11, 2023
1 parent 20afede commit 620389e
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 33 deletions.
5 changes: 3 additions & 2 deletions edi_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EDI
:target: https://runbot.odoo-community.org/runbot/226/15.0
:alt: Try me on Runbot

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

Base EDI backend.

Expand Down Expand Up @@ -142,6 +142,7 @@ Contributors

* Simone Orsi <[email protected]>
* Enric Tobella <[email protected]>
* John Herholz <[email protected]>

Maintainers
~~~~~~~~~~~
Expand All @@ -165,7 +166,7 @@ promote its widespread use.

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

|maintainer-simahawk| |maintainer-etobella|
|maintainer-simahawk| |maintainer-etobella|

This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/15.0/edi_oca>`_ project on GitHub.

Expand Down
2 changes: 1 addition & 1 deletion edi_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": "15.0.1.5.0",
"version": "16.0.1.0.0",
"website": "https://github.com/OCA/edi-framework",
"development_status": "Beta",
"license": "LGPL-3",
Expand Down
16 changes: 1 addition & 15 deletions edi_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import base64
import logging

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

from odoo.addons.component.exception import NoComponentError

Expand Down Expand Up @@ -181,14 +181,6 @@ def _get_exchange_type_domain(self, code):
("backend_id", "=", self.id),
]

def _delay_action(self, rec):
# TODO: Remove this on 16.0
_logger.warning(
"This function has been replaced by rec.with_delay(). "
"It will be removed on 16.0."
)
return self.with_delay(**rec._job_delay_params())

def exchange_generate(self, exchange_record, store=True, force=False, **kw):
"""Generate output content for given exchange record.
Expand All @@ -209,12 +201,6 @@ def exchange_generate(self, exchange_record, store=True, force=False, **kw):
"edi_exchange_state": "output_pending",
}
)
try:
# TODO: Remove this on 15.0, we will keep it in order to not break current
# installations
output = tools.pycompat.to_text(output)
except UnicodeDecodeError:
_logger.info("File is not a text, so it cannot be converted")
if output:
try:
self._validate_data(exchange_record, output)
Expand Down
14 changes: 5 additions & 9 deletions edi_oca/models/edi_exchange_consumer_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,8 @@ def _get_eval_context(self):
}

@api.model
def fields_view_get(
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
res = super().fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
def get_view(self, view_id=None, view_type="form", **options):
res = super().get_view(view_id, view_type, **options)
if view_type == "form":
doc = etree.XML(res["arch"])
for node in doc.xpath("//sheet"):
Expand All @@ -105,12 +101,12 @@ def fields_view_get(
# Override context for postprocessing
if view_id and res.get("base_model", self._name) != self._name:
View = View.with_context(base_model_name=res["base_model"])
new_arch, new_fields = View.postprocess_and_fields(doc, self._name)
new_arch, new_models = View.postprocess_and_fields(doc, self._name)
res["arch"] = new_arch
# We don't want to lose previous configuration, so, we only want to add
# the new fields
new_fields.update(res["fields"])
res["fields"] = new_fields
new_models.update(res["models"])
res["models"] = new_models
return res

def _edi_create_exchange_record_vals(self, exchange_type):
Expand Down
3 changes: 2 additions & 1 deletion edi_oca/tests/test_backend_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# @author: Simone Orsi <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import mock
from unittest import mock

from freezegun import freeze_time

from odoo import fields, tools
Expand Down
10 changes: 5 additions & 5 deletions edi_oca/tests/test_consumer_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def test_mixin(self):
"res_id": self.consumer_record.id,
}
exchange_record = self.backend.create_record("test_csv_output", vals)
self.consumer_record.refresh()
self.consumer_record.invalidate_model()
self.assertEqual(1, self.consumer_record.exchange_record_count)
action = self.consumer_record.action_view_edi_records()
self.consumer_record.refresh()
self.consumer_record.invalidate_model()
self.assertEqual(
exchange_record, self.env["edi.exchange.record"].search(action["domain"])
)
Expand All @@ -95,7 +95,7 @@ def test_expected_configuration(self):
)
# enable it
self.exchange_type_out.model_manual_btn = True
self.consumer_record.invalidate_cache(["edi_has_form_config", "edi_config"])
self.consumer_record.invalidate_model(["edi_has_form_config", "edi_config"])
self.assertEqual(
self.consumer_record.edi_config[str(self.exchange_type_out.id)],
{"form": {"btn": {"label": self.exchange_type_out.name}}},
Expand All @@ -104,7 +104,7 @@ def test_expected_configuration(self):
self.exchange_type_out.id
)
self.assertEqual(action["res_model"], "edi.exchange.record")
self.consumer_record.refresh()
self.consumer_record.invalidate_model()
self.assertNotIn(
str(self.exchange_type_out.id),
self.consumer_record.edi_config,
Expand All @@ -130,7 +130,7 @@ def test_multiple_backend(self):
.create({"backend_id": self.backend_02.id})
)
wizard.create_edi()
self.consumer_record.refresh()
self.consumer_record.invalidate_model()
self.assertNotIn(
str(self.exchange_type_new.id),
self.consumer_record.edi_config,
Expand Down
1 change: 1 addition & 0 deletions edi_oca/views/edi_exchange_record_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
type="object"
string="Related record"
attrs="{'invisible': [('res_id', '=', False)]}"
groups="base.group_no_one"
/>
<!-- FIXME: this `invisible` domain does not work -->
<button
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
PyYAML
1 change: 1 addition & 0 deletions setup/edi_oca/odoo/addons/edi_oca
6 changes: 6 additions & 0 deletions setup/edi_oca/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odoo_test_helper

0 comments on commit 620389e

Please sign in to comment.