mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[MIG] base_external_system Migration to 13.0
This commit is contained in:
committed by
Pedro M. Baeza
parent
df7608d90b
commit
9087b53bfd
@@ -24,7 +24,6 @@ class ExternalSystemAdapter(models.AbstractModel):
|
||||
ondelete="cascade",
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@contextmanager
|
||||
def client(self):
|
||||
"""Client object usable as a context manager to include destruction.
|
||||
@@ -42,12 +41,10 @@ class ExternalSystemAdapter(models.AbstractModel):
|
||||
finally:
|
||||
self.external_destroy_client(client)
|
||||
|
||||
@api.multi
|
||||
def external_get_client(self):
|
||||
"""Return a usable client representing the remote system."""
|
||||
self.ensure_one()
|
||||
|
||||
@api.multi
|
||||
def external_destroy_client(self, client):
|
||||
"""Perform any logic necessary to destroy the client connection.
|
||||
|
||||
@@ -57,7 +54,6 @@ class ExternalSystemAdapter(models.AbstractModel):
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
@api.multi
|
||||
def external_test_connection(self):
|
||||
"""Adapters should override this method, then call super if valid.
|
||||
|
||||
@@ -72,9 +68,7 @@ class ExternalSystemAdapter(models.AbstractModel):
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
context_self = self.with_context(no_create_interface=True)
|
||||
vals.update(
|
||||
{"system_type": self._name,}
|
||||
)
|
||||
vals.update({"system_type": self._name})
|
||||
record = super(ExternalSystemAdapter, context_self).create(vals)
|
||||
record.system_id.interface = record
|
||||
return record
|
||||
|
||||
Reference in New Issue
Block a user