diff --git a/partner_title_active/README.rst b/partner_title_active/README.rst new file mode 100644 index 00000000000..9047a39c927 --- /dev/null +++ b/partner_title_active/README.rst @@ -0,0 +1,78 @@ +==================== +Partner title active +==================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:2f8e19fa2b5e1e012ce7d31860053bc5b9e15bf4704d7dc64d30cbe0fbf61f2b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/17.0/partner_title_active + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-17-0/partner-contact-17-0-partner_title_active + :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/partner-contact&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds an ``Active`` field to the partner title model to be able to deactivate titles without deleting them + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Archive/unarchive partner titles. + +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 +======= + +Contributors +------------ + +- ``Camptocamp ``\ \_\_: + + - Maksym Yankin maksym.yankin@camptocamp.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. + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_title_active/__init__.py b/partner_title_active/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/partner_title_active/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_title_active/__manifest__.py b/partner_title_active/__manifest__.py new file mode 100644 index 00000000000..82d0e29c4ac --- /dev/null +++ b/partner_title_active/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Partner Title Active", + "version": "17.0.1.0.0", + "author": "Odoo Community Association (OCA), Camptocamp", + "license": "AGPL-3", + "category": "Contact", + "depends": [ + # Odoo/core + "base", + ], + "website": "https://github.com/OCA/partner-contact", + "data": [ + "views/res_partner_title.xml", + ], + "installable": True, +} diff --git a/partner_title_active/models/__init__.py b/partner_title_active/models/__init__.py new file mode 100644 index 00000000000..a98a606798e --- /dev/null +++ b/partner_title_active/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner_title diff --git a/partner_title_active/models/res_partner_title.py b/partner_title_active/models/res_partner_title.py new file mode 100644 index 00000000000..16ff11f83fe --- /dev/null +++ b/partner_title_active/models/res_partner_title.py @@ -0,0 +1,13 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class PartnerTitle(models.Model): + _inherit = "res.partner.title" + + active = fields.Boolean( + default=True, + help="The active field allows you to hide the title without removing it.", + ) diff --git a/partner_title_active/pyproject.toml b/partner_title_active/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/partner_title_active/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/partner_title_active/tests/__init__.py b/partner_title_active/tests/__init__.py new file mode 100644 index 00000000000..484fb30f6ff --- /dev/null +++ b/partner_title_active/tests/__init__.py @@ -0,0 +1 @@ +from . import test_partner_title diff --git a/partner_title_active/tests/test_partner_title.py b/partner_title_active/tests/test_partner_title.py new file mode 100644 index 00000000000..9397c38dce3 --- /dev/null +++ b/partner_title_active/tests/test_partner_title.py @@ -0,0 +1,23 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestPartnerTitle(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create( + { + "name": "A Partner", + "title": cls.env.ref("base.res_partner_title_mister").id, + } + ) + + def test_01_partner_title(self): + self.assertTrue(self.partner.title.active, "Title should be active by default") + self.partner.title.action_archive() + self.assertFalse( + self.partner.title.active, "Title should be inactive after archiving" + ) diff --git a/partner_title_active/views/res_partner_title.xml b/partner_title_active/views/res_partner_title.xml new file mode 100644 index 00000000000..6efc049398c --- /dev/null +++ b/partner_title_active/views/res_partner_title.xml @@ -0,0 +1,49 @@ + + + + + res.partner.title + + + + + + + + + res.partner.title + + + + + + + + + + + + res.partner.title.search + res.partner.title + + + + + + + + + +