diff --git a/partner_contact_access_link/README.rst b/partner_contact_access_link/README.rst new file mode 100644 index 000000000..88ff08c31 --- /dev/null +++ b/partner_contact_access_link/README.rst @@ -0,0 +1,98 @@ +=========================== +Partner contact access link +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/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/14.0/partner_contact_access_link + :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-14-0/partner-contact-14-0-partner_contact_access_link + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of the partners form +and to allow you to click on a button and open the full contact form +while watching a company form. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Go to *Contacts* (if you don't see the menu, you might need to install the + *Contacts* app, or go to any other module where you can browse partners). +#. Select any contact that is a company and contains sub-contacts. +#. You will see a new little button next to each contact's name that you + can click to go to hers/his full form: + + .. image:: https://raw.githubusercontent.com/OCA/partner-contact/14.0/partner_contact_access_link/static/description/full-form.gif + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Jairo Llopis (`Tecnativa `__) +* Harald Panten (`Sygel Technology `__) +* Tharathip Chaweewongphan + +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-Yajo| image:: https://github.com/Yajo.png?size=40px + :target: https://github.com/Yajo + :alt: Yajo + +Current `maintainer `__: + +|maintainer-Yajo| + +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_contact_access_link/__init__.py b/partner_contact_access_link/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/partner_contact_access_link/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_contact_access_link/__manifest__.py b/partner_contact_access_link/__manifest__.py new file mode 100644 index 000000000..e31e9a3ed --- /dev/null +++ b/partner_contact_access_link/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2020 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Partner contact access link", + "summary": "Allow to visit the full contact form from a company", + "version": "14.0.1.0.0", + "development_status": "Production/Stable", + "category": "Tools", + "website": "https://github.com/OCA/partner-contact", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["Yajo"], + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": ["base"], + "data": ["views/res_partner_views.xml"], +} diff --git a/partner_contact_access_link/i18n/partner_contact_access_link.pot b/partner_contact_access_link/i18n/partner_contact_access_link.pot new file mode 100644 index 000000000..92aceebab --- /dev/null +++ b/partner_contact_access_link/i18n/partner_contact_access_link.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_contact_access_link +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.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: partner_contact_access_link +#: model:ir.model,name:partner_contact_access_link.model_res_partner +msgid "Contact" +msgstr "" + +#. module: partner_contact_access_link +#: model_terms:ir.ui.view,arch_db:partner_contact_access_link.view_partner_form +msgid "Open full form" +msgstr "" diff --git a/partner_contact_access_link/models/__init__.py b/partner_contact_access_link/models/__init__.py new file mode 100644 index 000000000..91fed54d4 --- /dev/null +++ b/partner_contact_access_link/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner diff --git a/partner_contact_access_link/models/res_partner.py b/partner_contact_access_link/models/res_partner.py new file mode 100644 index 000000000..f2fb784b6 --- /dev/null +++ b/partner_contact_access_link/models/res_partner.py @@ -0,0 +1,19 @@ +# Copyright 2020 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + def open_child_form(self): + """Open child contact form from the parent partner form view""" + return { + "type": "ir.actions.act_window", + "res_model": "res.partner", + "res_id": self.id, + "view_mode": "form", + "view_type": "form", + "target": "current", + } diff --git a/partner_contact_access_link/readme/CONTRIBUTORS.rst b/partner_contact_access_link/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9ecf25f7e --- /dev/null +++ b/partner_contact_access_link/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Jairo Llopis (`Tecnativa `__) +* Harald Panten (`Sygel Technology `__) +* Tharathip Chaweewongphan diff --git a/partner_contact_access_link/readme/DESCRIPTION.rst b/partner_contact_access_link/readme/DESCRIPTION.rst new file mode 100644 index 000000000..d6f06d5be --- /dev/null +++ b/partner_contact_access_link/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module extends the functionality of the partners form +and to allow you to click on a button and open the full contact form +while watching a company form. diff --git a/partner_contact_access_link/readme/USAGE.rst b/partner_contact_access_link/readme/USAGE.rst new file mode 100644 index 000000000..81de8ddc7 --- /dev/null +++ b/partner_contact_access_link/readme/USAGE.rst @@ -0,0 +1,9 @@ +To use this module, you need to: + +#. Go to *Contacts* (if you don't see the menu, you might need to install the + *Contacts* app, or go to any other module where you can browse partners). +#. Select any contact that is a company and contains sub-contacts. +#. You will see a new little button next to each contact's name that you + can click to go to hers/his full form: + + .. image:: ../static/description/full-form.gif diff --git a/partner_contact_access_link/static/description/full-form.gif b/partner_contact_access_link/static/description/full-form.gif new file mode 100644 index 000000000..b31a460d2 Binary files /dev/null and b/partner_contact_access_link/static/description/full-form.gif differ diff --git a/partner_contact_access_link/static/description/icon.png b/partner_contact_access_link/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/partner_contact_access_link/static/description/icon.png differ diff --git a/partner_contact_access_link/static/description/index.html b/partner_contact_access_link/static/description/index.html new file mode 100644 index 000000000..01b75ea61 --- /dev/null +++ b/partner_contact_access_link/static/description/index.html @@ -0,0 +1,441 @@ + + + + + + +Partner contact access link + + + + + + diff --git a/partner_contact_access_link/tests/__init__.py b/partner_contact_access_link/tests/__init__.py new file mode 100644 index 000000000..aeb3c771c --- /dev/null +++ b/partner_contact_access_link/tests/__init__.py @@ -0,0 +1 @@ +from . import test_partner_contact_access_link diff --git a/partner_contact_access_link/tests/test_partner_contact_access_link.py b/partner_contact_access_link/tests/test_partner_contact_access_link.py new file mode 100644 index 000000000..cedc5788f --- /dev/null +++ b/partner_contact_access_link/tests/test_partner_contact_access_link.py @@ -0,0 +1,25 @@ +# Copyright 2020 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo.tests.common import TransactionCase + + +class TestPartnerContactAccessLink(TransactionCase): + def setUp(self): + super().setUp() + self.partner_model = self.env["res.partner"] + self.company = self.partner_model.create( + {"name": "Test Company", "company_type": "company"} + ) + self.contact = self.partner_model.create( + {"name": "Test Contact", "type": "contact", "parent_id": self.company.id} + ) + + def test_partner_contact_access_link(self): + res = self.contact.open_child_form() + self.assertEqual(res["type"], "ir.actions.act_window") + self.assertEqual(res["res_model"], "res.partner") + self.assertEqual(res["res_id"], self.contact.id) + self.assertEqual(res["view_mode"], "form") + self.assertEqual(res["view_type"], "form") + self.assertEqual(res["target"], "current") diff --git a/partner_contact_access_link/views/res_partner_views.xml b/partner_contact_access_link/views/res_partner_views.xml new file mode 100644 index 000000000..24450d57a --- /dev/null +++ b/partner_contact_access_link/views/res_partner_views.xml @@ -0,0 +1,26 @@ + + + + + Add button to see child contacts full form + res.partner + + + + + + + + + diff --git a/setup/partner_contact_access_link/odoo/addons/partner_contact_access_link b/setup/partner_contact_access_link/odoo/addons/partner_contact_access_link new file mode 120000 index 000000000..1cbfa4efc --- /dev/null +++ b/setup/partner_contact_access_link/odoo/addons/partner_contact_access_link @@ -0,0 +1 @@ +../../../../partner_contact_access_link \ No newline at end of file diff --git a/setup/partner_contact_access_link/setup.py b/setup/partner_contact_access_link/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/partner_contact_access_link/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)