Metadata-Version: 2.1
Name: odoo-addon-sms_alternative_provider
Version: 16.0.1.0.0.2
Summary: Base module for implementing alternative SMS gateways
Home-page: https://github.com/OCA/connector-telephony
Author: Hunki Enterprises BV, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 16.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.10
Requires-Dist: odoo<16.1dev,>=16.0a
Requires-Dist: phonenumbers

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

=============================
Alternative providers for SMS
=============================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:b327ac1da62d690dc8222f6460fe9f52a5dfaf62af3d7007f7d91f37863dca4f
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
    :target: https://odoo-community.org/page/development-status
    :alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector--telephony-lightgray.png?logo=github
    :target: https://github.com/OCA/connector-telephony/tree/16.0/sms_alternative_provider
    :alt: OCA/connector-telephony
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/connector-telephony-16-0/connector-telephony-16-0-sms_alternative_provider
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/connector-telephony&target_branch=16.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows configuring multiple providers for sending SMS.

By restricting providers to country or area codes, you can ie have Odoo
pick different providers for different countries.

.. IMPORTANT::
   This is an alpha version, the data model and design can change at any time without warning.
   Only for development or testing purpose, do not use in production.
   `More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
   :local:

Configuration
=============

To configure this module, you need to:

1. Go to Settings / Technical / Phone/SMS / SMS providers
2. Create/Edit providers, reorder them, restrict some provider to
   certain country or area codes

Usage
=====

This module doesn't do anything on its own, it is meant to be used by
developers to implement SMS providers.

To do this, it suffices to inherit the ``ir.sms.gateway`` model to add a
type:

::

   gateway_type = fields.Selection(selection_add=[("your_sms_provider", "Your SMS provider")])

and declare a function named like \_send\_$type:

::

   def _send_your_sms_provider(self, messages):
       # do here whatever you need to send the list of messages:
       # [{
       #    'id': id of the sms.sms record (may not be set),
       #    'number': the number to send the sms to
       #    'content': the content of the message
       # }]
       # return a list of dicts with sending results:
       # [{
       #    'id': id of the sms.sms record
       #    'state': sms.sms#state
       #    'failure_type': sms.sms#failure_type if state == 'error'
       #    # whatever other fields you want to write on the sms.sms record after sending,
       #    # such as provider-specific extra information
       # }]

Probably your provider needs some api key or similar to function, add
those fields prefixed with your gateway_type name to the gateway class:

::

   your_sms_provider_apikey = fields.Char('API key')

and add a group after group ``general`` in the form view of the model:

::

   <group name="general" position="after">
       <group name="your_sms_provider" attrs="{'invisible': [('gateway_type', '!=', 'your_sms_provider')]}">
           <field name="your_sms_provider_apikey" password="True" attrs="{'required': [('gateway_type', '=', 'your_sms_provider')]}" />
       </group>
   </group>

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-telephony/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/connector-telephony/issues/new?body=module:%20sms_alternative_provider%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Hunki Enterprises BV

Contributors
------------

- Holger Brunn <mail@hunki-enterprises.com>
  (https://hunki-enterprises.com)

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-hbrunn| image:: https://github.com/hbrunn.png?size=40px
    :target: https://github.com/hbrunn
    :alt: hbrunn

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-hbrunn| 

This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/16.0/sms_alternative_provider>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
