diff --git a/base_user_signature/README.rst b/base_user_signature/README.rst new file mode 100644 index 000000000..e7bb83a33 --- /dev/null +++ b/base_user_signature/README.rst @@ -0,0 +1,106 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=================== +Base User Signature +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bb768206e78f6c5903b31bf23452d9342f23d85833b10a8266df050e9096bcee + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |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%2Fmail-lightgray.png?logo=github + :target: https://github.com/OCA/mail/tree/19.0/base_user_signature + :alt: OCA/mail +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mail-19-0/mail-19-0-base_user_signature + :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/mail&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides a new field on users to store the user's digital +signature + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. Go to *Settings > Users & Companies > Users*. +2. Open one of the existing users. +3. You can set a digital signature for it on the field "Signature". + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp + +Contributors +------------ + +- Jay Vora +- Lorenzo Battistini +- Pedro M. Baeza +- Vicent Cubells +- Mayank Gosai +- Maxime Chambreuil +- Italo LOPES +- Saran Lim. +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +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-imlopes| image:: https://github.com/imlopes.png?size=40px + :target: https://github.com/imlopes + :alt: imlopes + +Current `maintainer `__: + +|maintainer-imlopes| + +This module is part of the `OCA/mail `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_user_signature/__init__.py b/base_user_signature/__init__.py new file mode 100644 index 000000000..063c02516 --- /dev/null +++ b/base_user_signature/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2004-2010 OpenERP SA () +# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/base_user_signature/__manifest__.py b/base_user_signature/__manifest__.py new file mode 100644 index 000000000..7cf5b67d8 --- /dev/null +++ b/base_user_signature/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2004-2010 OpenERP SA () +# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd. +# Copyright 2017 Tecnativa - Vicent Cubells +# Copyright 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Base User Signature", + "version": "19.0.1.0.0", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/mail", + "license": "AGPL-3", + "category": "Social", + "depends": [ + "mail", + "web", + ], + "data": [ + "views/res_users_view.xml", + ], + "installable": True, + "development_status": "Production/Stable", + "maintainers": ["imlopes"], +} diff --git a/base_user_signature/i18n/base_user_signature.pot b/base_user_signature/i18n/base_user_signature.pot new file mode 100644 index 000000000..255c966cb --- /dev/null +++ b/base_user_signature/i18n/base_user_signature.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_user_signature +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Clear" +msgstr "" + +#. module: base_user_signature +#: model:ir.model.fields,field_description:base_user_signature.field_res_users__digital_signature +msgid "Digital Signature" +msgstr "" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Signature" +msgstr "" + +#. module: base_user_signature +#: model:ir.model,name:base_user_signature.model_res_users +msgid "User" +msgstr "" diff --git a/base_user_signature/i18n/de.po b/base_user_signature/i18n/de.po new file mode 100644 index 000000000..021067755 --- /dev/null +++ b/base_user_signature/i18n/de.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_user_signature +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Clear" +msgstr "" + +#. module: base_user_signature +#: model:ir.model.fields,field_description:base_user_signature.field_res_users__digital_signature +msgid "Digital Signature" +msgstr "" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Signature" +msgstr "" + +#. module: base_user_signature +#: model:ir.model,name:base_user_signature.model_res_users +msgid "User" +msgstr "" diff --git a/base_user_signature/i18n/fr.po b/base_user_signature/i18n/fr.po new file mode 100644 index 000000000..102e6d6dd --- /dev/null +++ b/base_user_signature/i18n/fr.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_user_signature +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-09-07 10:48+0000\n" +"PO-Revision-Date: 2022-09-07 10:48+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Clear" +msgstr "Effacer" + +#. module: base_user_signature +#: model:ir.model.fields,field_description:base_user_signature.field_res_users__digital_signature +msgid "Digital Signature" +msgstr "Signature numérique" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Signature" +msgstr "Signature" + +#. module: base_user_signature +#: model:ir.model,name:base_user_signature.model_res_users +msgid "User" +msgstr "" diff --git a/base_user_signature/i18n/it.po b/base_user_signature/i18n/it.po new file mode 100644 index 000000000..b819f64cd --- /dev/null +++ b/base_user_signature/i18n/it.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_user_signature +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-24 11:57+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Clear" +msgstr "Pulisci" + +#. module: base_user_signature +#: model:ir.model.fields,field_description:base_user_signature.field_res_users__digital_signature +msgid "Digital Signature" +msgstr "Firma digitale" + +#. module: base_user_signature +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_form +#: model_terms:ir.ui.view,arch_db:base_user_signature.inherited_res_users_preferences_form +msgid "Signature" +msgstr "Firma" + +#. module: base_user_signature +#: model:ir.model,name:base_user_signature.model_res_users +msgid "User" +msgstr "Utente" diff --git a/base_user_signature/models/__init__.py b/base_user_signature/models/__init__.py new file mode 100644 index 000000000..883516533 --- /dev/null +++ b/base_user_signature/models/__init__.py @@ -0,0 +1 @@ +from . import res_users diff --git a/base_user_signature/models/res_users.py b/base_user_signature/models/res_users.py new file mode 100644 index 000000000..b8ddef0d8 --- /dev/null +++ b/base_user_signature/models/res_users.py @@ -0,0 +1,28 @@ +# Copyright 2004-2010 OpenERP SA () +# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd. +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + digital_signature = fields.Image( + copy=False, + max_width=1024, + max_height=1024, + ) + + def clear_digital_signature(self): + self.digital_signature = False + + @property + def SELF_READABLE_FIELDS(self): + return super().SELF_READABLE_FIELDS + ["digital_signature"] + + @property + def SELF_WRITEABLE_FIELDS(self): + return super().SELF_WRITEABLE_FIELDS + ["digital_signature"] diff --git a/base_user_signature/pyproject.toml b/base_user_signature/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/base_user_signature/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/base_user_signature/readme/CONTRIBUTORS.md b/base_user_signature/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..10c041aa9 --- /dev/null +++ b/base_user_signature/readme/CONTRIBUTORS.md @@ -0,0 +1,10 @@ +- Jay Vora \<\> +- Lorenzo Battistini \<\> +- Pedro M. Baeza \<\> +- Vicent Cubells \<\> +- Mayank Gosai \<\> +- Maxime Chambreuil \<\> +- Italo LOPES \<\> +- Saran Lim. \<\> +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/base_user_signature/readme/DESCRIPTION.md b/base_user_signature/readme/DESCRIPTION.md new file mode 100644 index 000000000..e84ef3e56 --- /dev/null +++ b/base_user_signature/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module provides a new field on users to store the user's digital +signature diff --git a/base_user_signature/readme/USAGE.md b/base_user_signature/readme/USAGE.md new file mode 100644 index 000000000..115332f3c --- /dev/null +++ b/base_user_signature/readme/USAGE.md @@ -0,0 +1,3 @@ +1. Go to *Settings \> Users & Companies \> Users*. +2. Open one of the existing users. +3. You can set a digital signature for it on the field "Signature". diff --git a/base_user_signature/static/description/icon.png b/base_user_signature/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/base_user_signature/static/description/icon.png differ diff --git a/base_user_signature/static/description/index.html b/base_user_signature/static/description/index.html new file mode 100644 index 000000000..776f92a25 --- /dev/null +++ b/base_user_signature/static/description/index.html @@ -0,0 +1,452 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Base User Signature

+ +

Production/Stable License: AGPL-3 OCA/mail Translate me on Weblate Try me on Runboat

+

This module provides a new field on users to store the user’s digital +signature

+

Table of contents

+ +
+

Usage

+
    +
  1. Go to Settings > Users & Companies > Users.
  2. +
  3. Open one of the existing users.
  4. +
  5. You can set a digital signature for it on the field “Signature”.
  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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

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:

+

imlopes

+

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

+

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

+
+
+
+
+ + diff --git a/base_user_signature/tests/__init__.py b/base_user_signature/tests/__init__.py new file mode 100644 index 000000000..da998a1a5 --- /dev/null +++ b/base_user_signature/tests/__init__.py @@ -0,0 +1 @@ +from . import test_base_user_signature diff --git a/base_user_signature/tests/test_base_user_signature.py b/base_user_signature/tests/test_base_user_signature.py new file mode 100644 index 000000000..bc99eb0b0 --- /dev/null +++ b/base_user_signature/tests/test_base_user_signature.py @@ -0,0 +1,66 @@ +from base64 import b64encode +from io import BytesIO + +from PIL import Image + +from odoo.addons.base.tests.common import SavepointCaseWithUserDemo + + +class TestResUsersDigitalSignature(SavepointCaseWithUserDemo): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.user_model = cls.env["res.users"] + + # Create a test user + cls.user = cls.user_model.create( + { + "name": "Test User", + "login": "test_user", + "email": "test_user@example.com", + } + ) + + def _generate_sample_image(self): + """Generate a small valid image and return its base64-encoded content.""" + img = Image.new("RGB", (10, 10), color="red") # Create a red 10x10 image + buffer = BytesIO() + img.save(buffer, format="PNG") + return b64encode(buffer.getvalue()).decode("ascii") + + def test_digital_signature_field(self): + """Test assigning and clearing the digital signature field.""" + # Generate a valid base64-encoded image + test_signature = self._generate_sample_image() + + # Assign a digital signature to the user + self.user.digital_signature = test_signature + self.assertEqual( + self.user.digital_signature.decode("ascii"), + test_signature, + "Digital signature should be set correctly.", + ) + + # Clear the digital signature using the method + self.user.clear_digital_signature() + self.assertFalse( + self.user.digital_signature, "Digital signature should be cleared." + ) + + def test_self_readable_fields(self): + """Test if 'digital_signature' is included in SELF_READABLE_FIELDS.""" + readable_fields = self.user.SELF_READABLE_FIELDS + self.assertIn( + "digital_signature", + readable_fields, + "'digital_signature' should be in SELF_READABLE_FIELDS.", + ) + + def test_self_writeable_fields(self): + """Test if 'digital_signature' is included in SELF_WRITEABLE_FIELDS.""" + writeable_fields = self.user.SELF_WRITEABLE_FIELDS + self.assertIn( + "digital_signature", + writeable_fields, + "'digital_signature' should be in SELF_WRITEABLE_FIELDS.", + ) diff --git a/base_user_signature/views/res_users_view.xml b/base_user_signature/views/res_users_view.xml new file mode 100644 index 000000000..9af8a30b5 --- /dev/null +++ b/base_user_signature/views/res_users_view.xml @@ -0,0 +1,52 @@ + + + + inherited.res.users.form + res.users + + + + + + + + + inherited.res.users.preferences.form + res.users + + + + + + +