[MIG] base_external_system Migration to 13.0

This commit is contained in:
Ronald Portier
2020-08-20 14:19:38 +02:00
parent e05496d065
commit c5f14c3a45
6 changed files with 6 additions and 17 deletions

View File

@@ -4,14 +4,14 @@
{
"name": "Base External System",
"summary": "Data models allowing for connection to external systems.",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"category": "Base",
"website": "https://github.com/OCA/server-backend",
"author": "LasLabs, " "Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["base",],
"depends": ["base"],
"data": [
"demo/external_system_os_demo.xml",
"security/ir.model.access.csv",

View File

@@ -74,7 +74,6 @@ class ExternalSystem(models.Model):
adapter = self.env["external.system.adapter"]
return [(m, self.env[m]._description) for m in adapter._inherit_children]
@api.multi
@api.constrains("fingerprint", "ignore_fingerprint")
def check_fingerprint_ignore_fingerprint(self):
"""Do not allow a blank fingerprint if not set to ignore."""
@@ -87,7 +86,6 @@ class ExternalSystem(models.Model):
)
)
@api.multi
@contextmanager
def client(self):
"""Client object usable as a context manager to include destruction.
@@ -107,11 +105,10 @@ class ExternalSystem(models.Model):
"""Create the interface for the record and assign to ``interface``."""
record = super(ExternalSystem, self).create(vals)
if not self.env.context.get("no_create_interface"):
interface = self.env[vals["system_type"]].create({"system_id": record.id,})
interface = self.env[vals["system_type"]].create({"system_id": record.id})
record.interface = interface
return record
@api.multi
def action_test_connection(self):
"""Test the connection to the external system."""
self.ensure_one()

View File

@@ -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

View File

@@ -3,7 +3,7 @@
import os
from odoo import api, models
from odoo import models
class ExternalSystemOs(models.Model):
@@ -19,7 +19,6 @@ class ExternalSystemOs(models.Model):
previous_dir = None
@api.multi
def external_get_client(self):
"""Return a usable client representing the remote system."""
super(ExternalSystemOs, self).external_get_client()
@@ -28,7 +27,6 @@ class ExternalSystemOs(models.Model):
os.chdir(self.system_id.remote_path)
return os
@api.multi
def external_destroy_client(self, client):
"""Perform any logic necessary to destroy the client connection.

View File

@@ -1,2 +1,3 @@
* Dave Lasley <dave@laslabs.com>
* Alexandre Díaz <alexandre.diaz@tecnativa.com>
* Ronald Portier <ronald@therp.nl>

View File

@@ -97,7 +97,6 @@
<field name="name">External Systems</field>
<field name="res_model">external.system</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem