mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[IMP] base_external_system: black, isort, prettier
This commit is contained in:
committed by
ntsirintanis
parent
748345c0b2
commit
f7012c4576
@@ -13,7 +13,8 @@ class ExternalSystem(models.Model):
|
|||||||
_description = "External System"
|
_description = "External System"
|
||||||
|
|
||||||
name = fields.Char(
|
name = fields.Char(
|
||||||
required=True, help="This is the canonical (humanized) name for the system.",
|
required=True,
|
||||||
|
help="This is the canonical (humanized) name for the system.",
|
||||||
)
|
)
|
||||||
host = fields.Char(
|
host = fields.Char(
|
||||||
help="This is the domain or IP address that the system can be reached " "at.",
|
help="This is the domain or IP address that the system can be reached " "at.",
|
||||||
@@ -56,7 +57,10 @@ class ExternalSystem(models.Model):
|
|||||||
default=lambda s: [(6, 0, s.env.user.company_id.ids)],
|
default=lambda s: [(6, 0, s.env.user.company_id.ids)],
|
||||||
help="Access to this system is restricted to these companies.",
|
help="Access to this system is restricted to these companies.",
|
||||||
)
|
)
|
||||||
system_type = fields.Selection(selection="_get_system_types", required=True,)
|
system_type = fields.Selection(
|
||||||
|
selection="_get_system_types",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
interface = fields.Reference(
|
interface = fields.Reference(
|
||||||
selection="_get_system_types",
|
selection="_get_system_types",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
|
|||||||
@@ -43,12 +43,15 @@ class TestExternalSystem(Common):
|
|||||||
{"name": "Test", "system_type": "external.system.os"}
|
{"name": "Test", "system_type": "external.system.os"}
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
record.interface._name, "external.system.os",
|
record.interface._name,
|
||||||
|
"external.system.os",
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_context_override(self):
|
def test_create_context_override(self):
|
||||||
"""It should allow for interface create override with context."""
|
"""It should allow for interface create override with context."""
|
||||||
model = self.env["external.system"].with_context(no_create_interface=True,)
|
model = self.env["external.system"].with_context(
|
||||||
|
no_create_interface=True,
|
||||||
|
)
|
||||||
record = model.create({"name": "Test", "system_type": "external.system.os"})
|
record = model.create({"name": "Test", "system_type": "external.system.os"})
|
||||||
self.assertFalse(record.interface)
|
self.assertFalse(record.interface)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user