Skip to content

Commit

Permalink
[IMP]edi_endpoint_oca: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillemCForgeFlow committed Oct 29, 2024
1 parent 944b2e0 commit 12ea92b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
4 changes: 1 addition & 3 deletions edi_endpoint_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class EDIBackend(models.Model):
_inherit = "edi.backend"

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

Expand Down
4 changes: 1 addition & 3 deletions edi_endpoint_oca/models/edi_backend_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ class EDIBackendType(models.Model):
_inherit = "edi.backend.type"

endpoint_ids = fields.One2many(
string="Endpoints",
comodel_name="edi.endpoint",
inverse_name="backend_type_id",
string="Endpoints", comodel_name="edi.endpoint", inverse_name="backend_type_id",
)
5 changes: 1 addition & 4 deletions edi_endpoint_oca/models/edi_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ class EDIEndpoint(models.Model):

_endpoint_route_prefix = "/edi"

backend_type_id = fields.Many2one(
comodel_name="edi.backend.type",
required=True,
)
backend_type_id = fields.Many2one(comodel_name="edi.backend.type", required=True,)
# Leave these as not required to allow pre-configuration of endpoints by backend type
backend_id = fields.Many2one(
comodel_name="edi.backend", domain="[('backend_type_id','=', backend_type_id)]"
Expand Down
12 changes: 2 additions & 10 deletions edi_endpoint_oca/tests/test_edi_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,13 @@ def test_exchange_record(self):
self.assertEqual(rec.edi_endpoint_id, self.endpoint)

def test_route(self):
rec = self.endpoint.copy(
{
"route": "/noprefix",
}
)
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",
}
)
rec = self.endpoint.copy({"route": "/another",})
self.assertEqual(backend.endpoints_count, 2)
rec.active = False
self.assertEqual(backend.endpoints_count, 1)
Expand Down
1 change: 1 addition & 0 deletions setup/edi_endpoint_oca/odoo/addons/edi_endpoint_oca
6 changes: 6 additions & 0 deletions setup/edi_endpoint_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,
)

0 comments on commit 12ea92b

Please sign in to comment.