Skip to content

Commit

Permalink
[ADD] sms_dummy_provider
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Feb 14, 2025
1 parent 73f6c71 commit 1738eb4
Show file tree
Hide file tree
Showing 13 changed files with 641 additions and 0 deletions.
1 change: 1 addition & 0 deletions setup/sms_dummy_provider/odoo/addons/sms_dummy_provider
6 changes: 6 additions & 0 deletions setup/sms_dummy_provider/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
101 changes: 101 additions & 0 deletions sms_dummy_provider/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
=========================
SMS provider: Messagebird
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:211fd292e6cdc76561c38b96220576ac59ab58d5011a1ddfa7d5b7ef3bb13588
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/licence-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_dummy_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_dummy_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 adds a dummy provider you can use for testing your SMS
flows.

.. 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 a gateway of type dummy, set the state you want SMS sent via
this provider to end up in
3. Sent SMS will show in field ``Results``

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_dummy_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 <[email protected]>
(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_dummy_provider>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sms_dummy_provider/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions sms_dummy_provider/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

{
"name": "SMS provider: Messagebird",
"summary": "Send SMS via messagebird.com",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"category": "Tools",
"website": "https://github.com/OCA/connector-telephony",
"author": "Hunki Enterprises BV, Odoo Community Association (OCA)",
"maintainers": ["hbrunn"],
"license": "AGPL-3",
"depends": [
"sms_alternative_provider",
],
"data": [
"views/ir_sms_gateway.xml",
],
}
1 change: 1 addition & 0 deletions sms_dummy_provider/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_sms_gateway
36 changes: 36 additions & 0 deletions sms_dummy_provider/models/ir_sms_gateway.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2024 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)


from odoo import fields, models


class IrSmsGateway(models.Model):

_inherit = "ir.sms.gateway"

gateway_type = fields.Selection(
selection_add=[("dummy", "Dummy")],
ondelete={"dummy": "cascade"},
)
dummy_state = fields.Selection(
lambda self: self.env["sms.sms"]._fields["state"].selection, "State"
)
dummy_result = fields.Text("Sent messages")

def _send_dummy(self, messages):
result = []
dummy_result = self.dummy_result or ""
for message in messages:
dummy_result += "\n %s " % fields.Datetime.now() + message["content"]
result.append(
{
"id": message.get("id"),
"state": self.dummy_state,
"failure_type": "sms_server"
if self.dummy_state == "error"
else False,
}
)
self.write({"dummy_result": dummy_result})
return result
5 changes: 5 additions & 0 deletions sms_dummy_provider/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To configure this module, you need to:

1. Go to Settings / Technical / Phone/SMS / SMS providers
2. Create a gateway of type dummy, set the state you want SMS sent via this provider to end up in
3. Sent SMS will show in field ``Results``
1 change: 1 addition & 0 deletions sms_dummy_provider/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Holger Brunn \<[email protected]> (https://hunki-enterprises.com)
1 change: 1 addition & 0 deletions sms_dummy_provider/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds a dummy provider you can use for testing your SMS flows.
Binary file added sms_dummy_provider/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1738eb4

Please sign in to comment.