Source code for connector.components.backend_adapter

# -*- coding: utf-8 -*-
# Copyright 2013-2017 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)

"""

Backend Adapter
===============

An external adapter has a common interface to speak with the backend.
It translates the basic orders (search, read, write) to the protocol
used by the backend.

"""

from odoo.addons.component.core import AbstractComponent


[docs]class BackendAdapter(AbstractComponent): """ Base Backend Adapter for the connectors """ _name = 'base.backend.adapter' _inherit = 'base.connector' _usage = 'backend.adapter'
[docs]class CRUDAdapter(AbstractComponent): """ Base External Adapter specialized in the handling of records on external systems. This is an empty shell, Components can inherit and implement their own implementation for the methods. """ _name = 'base.backend.adapter.crud' _inherit = 'base.backend.adapter' _usage = 'backend.adapter'
[docs] def search(self, *args, **kwargs): """ Search records according to some criterias and returns a list of ids """ raise NotImplementedError
[docs] def read(self, *args, **kwargs): """ Returns the information of a record """ raise NotImplementedError
[docs] def search_read(self, *args, **kwargs): """ Search records according to some criterias and returns their information""" raise NotImplementedError
[docs] def create(self, *args, **kwargs): """ Create a record on the external system """ raise NotImplementedError
[docs] def write(self, *args, **kwargs): """ Update records on the external system """ raise NotImplementedError
[docs] def delete(self, *args, **kwargs): """ Delete a record on the external system """ raise NotImplementedError