diff --git a/setup/website_whatsapp/odoo/addons/website_whatsapp b/setup/website_whatsapp/odoo/addons/website_whatsapp new file mode 120000 index 0000000000..c16fca894b --- /dev/null +++ b/setup/website_whatsapp/odoo/addons/website_whatsapp @@ -0,0 +1 @@ +../../../../website_whatsapp \ No newline at end of file diff --git a/setup/website_whatsapp/setup.py b/setup/website_whatsapp/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_whatsapp/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_whatsapp/README.rst b/website_whatsapp/README.rst new file mode 100644 index 0000000000..65ce8a5b31 --- /dev/null +++ b/website_whatsapp/README.rst @@ -0,0 +1,91 @@ +================ +Website Whatsapp +================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |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%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/15.0/website_whatsapp + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-15-0/website-15-0-website_whatsapp + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/186/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Enable a WhatsApp floating button on the website to be able to send a message quickly + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +#. Go to **Website > Configuration > Settings** +#. Search 'Use Whatsapp' option. +#. Fill in your 'WhatsApp number' and the other optional values + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Studio73 + +Contributors +~~~~~~~~~~~~ + +* `Studio73 `__: + * Ioan Galan + +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-ioans73| image:: https://github.com/ioans73.png?size=40px + :target: https://github.com/ioans73 + :alt: ioans73 + +Current `maintainer `__: + +|maintainer-ioans73| + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_whatsapp/__init__.py b/website_whatsapp/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_whatsapp/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_whatsapp/__manifest__.py b/website_whatsapp/__manifest__.py new file mode 100644 index 0000000000..a813512100 --- /dev/null +++ b/website_whatsapp/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2022 Studio73 - Ioan Galan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Website Whatsapp", + "summary": "Whatsapp integration", + "category": "Website", + "version": "16.0.1.0.0", + "website": "https://github.com/OCA/website", + "author": "Studio73, Odoo Community Association (OCA)", + "maintainers": ["ioans73"], + "license": "AGPL-3", + "depends": ["website"], + "data": [ + "templates/website.xml", + "views/res_config_settings.xml", + ], + "assets": { + "web.assets_frontend": ["/website_whatsapp/static/src/scss/website.scss"] + }, + "installable": True, +} diff --git a/website_whatsapp/i18n/website_whatsapp.pot b/website_whatsapp/i18n/website_whatsapp.pot new file mode 100644 index 0000000000..0b46f3a30c --- /dev/null +++ b/website_whatsapp/i18n/website_whatsapp.pot @@ -0,0 +1,72 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_whatsapp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_whatsapp +#: model_terms:ir.ui.view,arch_db:website_whatsapp.res_config_settings_view_form +msgid "" +"" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model,name:website_whatsapp.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model.fields,field_description:website_whatsapp.field_res_config_settings__whatsapp_text +#: model:ir.model.fields,field_description:website_whatsapp.field_website__whatsapp_text +msgid "Default text for Whatsapp" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model.fields,help:website_whatsapp.field_res_config_settings__whatsapp_text +#: model:ir.model.fields,help:website_whatsapp.field_website__whatsapp_text +msgid "Default text to send as message" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model.fields,help:website_whatsapp.field_res_config_settings__whatsapp_track_url +#: model:ir.model.fields,help:website_whatsapp.field_website__whatsapp_track_url +msgid "" +"Indicate in the user's message the URL of the page from which it was sent" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model.fields,field_description:website_whatsapp.field_res_config_settings__whatsapp_track_url +#: model:ir.model.fields,field_description:website_whatsapp.field_website__whatsapp_track_url +msgid "Track URL" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model.fields,field_description:website_whatsapp.field_res_config_settings__whatsapp_enabled +msgid "Use Whatsapp" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model,name:website_whatsapp.model_website +msgid "Website" +msgstr "" + +#. module: website_whatsapp +#: model:ir.model.fields,field_description:website_whatsapp.field_res_config_settings__whatsapp_number +#: model:ir.model.fields,field_description:website_whatsapp.field_website__whatsapp_number +msgid "WhatsApp number" +msgstr "" + +#. module: website_whatsapp +#: model_terms:ir.ui.view,arch_db:website_whatsapp.res_config_settings_view_form +msgid "You must add the mobile number with the country prefix" +msgstr "" diff --git a/website_whatsapp/models/__init__.py b/website_whatsapp/models/__init__.py new file mode 100644 index 0000000000..ba62e1412d --- /dev/null +++ b/website_whatsapp/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_config_settings +from . import website diff --git a/website_whatsapp/models/res_config_settings.py b/website_whatsapp/models/res_config_settings.py new file mode 100644 index 0000000000..48a9cd60e8 --- /dev/null +++ b/website_whatsapp/models/res_config_settings.py @@ -0,0 +1,36 @@ +# Copyright 2022 Studio73 - Ioan Galan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + @api.depends("website_id.whatsapp_number") + def _compute_whatsapp_enabled(self): + for record in self: + record.update({"whatsapp_enabled": bool(record.whatsapp_number)}) + + def _inverse_whatsapp_enabled(self): + for record in self: + if not record.whatsapp_enabled: + record.website_id.update({"whatsapp_number": False}) + + whatsapp_number = fields.Char( + related="website_id.whatsapp_number", + readonly=False, + ) + whatsapp_text = fields.Char( + related="website_id.whatsapp_text", + readonly=False, + ) + whatsapp_track_url = fields.Boolean( + related="website_id.whatsapp_track_url", + readonly=False, + ) + whatsapp_enabled = fields.Boolean( + string="Use Whatsapp", + compute="_compute_whatsapp_enabled", + inverse="_inverse_whatsapp_enabled", + ) diff --git a/website_whatsapp/models/website.py b/website_whatsapp/models/website.py new file mode 100644 index 0000000000..c274d5c34f --- /dev/null +++ b/website_whatsapp/models/website.py @@ -0,0 +1,19 @@ +# Copyright 2022 Studio73 - Ioan Galan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class Website(models.Model): + _inherit = "website" + + whatsapp_number = fields.Char(string="WhatsApp number") + whatsapp_text = fields.Char( + "Default text for Whatsapp", + help="Default text to send as message", + ) + whatsapp_track_url = fields.Boolean( + "Track URL", + help="Indicate in the user's message the URL of the page from which it " + "was sent", + ) diff --git a/website_whatsapp/readme/CONFIGURE.rst b/website_whatsapp/readme/CONFIGURE.rst new file mode 100644 index 0000000000..69bce37d8e --- /dev/null +++ b/website_whatsapp/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +To configure this module, you need to: + +#. Go to **Website > Configuration > Settings** +#. Search 'Use Whatsapp' option. +#. Fill in your 'WhatsApp number' and the other optional values diff --git a/website_whatsapp/readme/CONTRIBUTORS.rst b/website_whatsapp/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..946245f774 --- /dev/null +++ b/website_whatsapp/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* `Studio73 `__: + * Ioan Galan diff --git a/website_whatsapp/readme/DESCRIPTION.rst b/website_whatsapp/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..676ff11fa3 --- /dev/null +++ b/website_whatsapp/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Enable a WhatsApp floating button on the website to be able to send a message quickly diff --git a/website_whatsapp/static/description/icon.png b/website_whatsapp/static/description/icon.png new file mode 100644 index 0000000000..e8334ea826 Binary files /dev/null and b/website_whatsapp/static/description/icon.png differ diff --git a/website_whatsapp/static/description/index.html b/website_whatsapp/static/description/index.html new file mode 100644 index 0000000000..f7eb29f6a1 --- /dev/null +++ b/website_whatsapp/static/description/index.html @@ -0,0 +1,438 @@ + + + + + + +Website Whatsapp + + + +
+

Website Whatsapp

+ + +

Beta License: AGPL-3 OCA/website Translate me on Weblate Try me on Runbot

+

Enable a WhatsApp floating button on the website to be able to send a message quickly

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Website > Configuration > Settings
  2. +
  3. Search ‘Use Whatsapp’ option.
  4. +
  5. Fill in your ‘WhatsApp number’ and the other optional values
  6. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Studio73
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

ioans73

+

This module is part of the OCA/website project on GitHub.

+

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

+
+
+
+ + diff --git a/website_whatsapp/static/src/scss/website.scss b/website_whatsapp/static/src/scss/website.scss new file mode 100644 index 0000000000..ead644b778 --- /dev/null +++ b/website_whatsapp/static/src/scss/website.scss @@ -0,0 +1,32 @@ +#whatsapp_icon { + z-index: 9999; + position: fixed; + bottom: 50px; + right: 30px; + background: #01e675; + width: 50px; + height: 50px; + text-decoration: none; + -webkit-border-radius: 35px; + -moz-border-radius: 35px; + border-radius: 35px; + -webkit-transition: all 0.3s linear; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; + border: 3px solid white; + display: flex; + justify-content: center; + align-items: center; + i { + color: #fff; + font-size: 30px; + } + @media (max-width: 576px) { + & { + bottom: 90px; + right: 10px; + } + } +} diff --git a/website_whatsapp/templates/website.xml b/website_whatsapp/templates/website.xml new file mode 100644 index 0000000000..c206c3163d --- /dev/null +++ b/website_whatsapp/templates/website.xml @@ -0,0 +1,26 @@ + + + + diff --git a/website_whatsapp/views/res_config_settings.xml b/website_whatsapp/views/res_config_settings.xml new file mode 100644 index 0000000000..7e30cd2eff --- /dev/null +++ b/website_whatsapp/views/res_config_settings.xml @@ -0,0 +1,59 @@ + + + + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+