From 5b394ef1ddb215fe7d768049e6c5b6485d24bb36 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 21 Oct 2021 12:11:00 +0700 Subject: [PATCH 01/11] [ADD] partner_title_order --- partner_title_order/README.rst | 83 ++++ partner_title_order/__init__.py | 1 + partner_title_order/__manifest__.py | 18 + partner_title_order/models/__init__.py | 1 + .../models/res_partner_title.py | 11 + partner_title_order/readme/CONTRIBUTORS.rst | 3 + partner_title_order/readme/CREDITS.rst | 4 + partner_title_order/readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 436 ++++++++++++++++++ partner_title_order/tests/__init__.py | 1 + .../tests/test_partner_title.py | 33 ++ .../views/res_partner_title_views.xml | 26 ++ 12 files changed, 618 insertions(+) create mode 100644 partner_title_order/README.rst create mode 100644 partner_title_order/__init__.py create mode 100644 partner_title_order/__manifest__.py create mode 100644 partner_title_order/models/__init__.py create mode 100644 partner_title_order/models/res_partner_title.py create mode 100644 partner_title_order/readme/CONTRIBUTORS.rst create mode 100644 partner_title_order/readme/CREDITS.rst create mode 100644 partner_title_order/readme/DESCRIPTION.rst create mode 100644 partner_title_order/static/description/index.html create mode 100644 partner_title_order/tests/__init__.py create mode 100644 partner_title_order/tests/test_partner_title.py create mode 100644 partner_title_order/views/res_partner_title_views.xml diff --git a/partner_title_order/README.rst b/partner_title_order/README.rst new file mode 100644 index 000000000000..29e5d4f4f8c0 --- /dev/null +++ b/partner_title_order/README.rst @@ -0,0 +1,83 @@ +=================== +Partner title order +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/14.0/partner_title_order + :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_title_order + :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| + +Add sequence to partner title to be able to determine their order. + +**Table of contents** + +.. contents:: + :local: + +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 +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Simone Orsi +* `Trobz `_: + * Khoi Vo + +Other credits +~~~~~~~~~~~~~ + +**Financial support** + +* Cosanum +* Camptocamp R&D + +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_order/__init__.py b/partner_title_order/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/partner_title_order/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_title_order/__manifest__.py b/partner_title_order/__manifest__.py new file mode 100644 index 000000000000..ff7f9bd96570 --- /dev/null +++ b/partner_title_order/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Partner title order", + "summary": "Makes partner title sortable by sequence", + "version": "14.0.1.0.0", + "category": "Hidden", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "base", + ], + "website": "https://github.com/OCA/partner-contact", + "data": [ + "views/res_partner_title_views.xml", + ], + "installable": True, +} diff --git a/partner_title_order/models/__init__.py b/partner_title_order/models/__init__.py new file mode 100644 index 000000000000..a98a606798e4 --- /dev/null +++ b/partner_title_order/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner_title diff --git a/partner_title_order/models/res_partner_title.py b/partner_title_order/models/res_partner_title.py new file mode 100644 index 000000000000..0a2af0b7c2a7 --- /dev/null +++ b/partner_title_order/models/res_partner_title.py @@ -0,0 +1,11 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo import fields, models + + +class ResPartnerTitle(models.Model): + _inherit = "res.partner.title" + _order = "sequence, name" + + sequence = fields.Integer(default=10) diff --git a/partner_title_order/readme/CONTRIBUTORS.rst b/partner_title_order/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..ede66d84b410 --- /dev/null +++ b/partner_title_order/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Simone Orsi +* `Trobz `_: + * Khoi Vo diff --git a/partner_title_order/readme/CREDITS.rst b/partner_title_order/readme/CREDITS.rst new file mode 100644 index 000000000000..4641e1066174 --- /dev/null +++ b/partner_title_order/readme/CREDITS.rst @@ -0,0 +1,4 @@ +**Financial support** + +* Cosanum +* Camptocamp R&D diff --git a/partner_title_order/readme/DESCRIPTION.rst b/partner_title_order/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..a76907293f84 --- /dev/null +++ b/partner_title_order/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Add sequence to partner title to be able to determine their order. diff --git a/partner_title_order/static/description/index.html b/partner_title_order/static/description/index.html new file mode 100644 index 000000000000..a6b5cdb5ca01 --- /dev/null +++ b/partner_title_order/static/description/index.html @@ -0,0 +1,436 @@ + + + + + + +Partner title order + + + +
+

Partner title order

+ + +

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

+

Add sequence to partner title to be able to determine their order.

+

Table of contents

+ +
+

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

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

Financial support

+
    +
  • Cosanum
  • +
  • Camptocamp R&D
  • +
+
+
+

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.

+

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_order/tests/__init__.py b/partner_title_order/tests/__init__.py new file mode 100644 index 000000000000..484fb30f6fff --- /dev/null +++ b/partner_title_order/tests/__init__.py @@ -0,0 +1 @@ +from . import test_partner_title diff --git a/partner_title_order/tests/test_partner_title.py b/partner_title_order/tests/test_partner_title.py new file mode 100644 index 000000000000..646a8a410bd8 --- /dev/null +++ b/partner_title_order/tests/test_partner_title.py @@ -0,0 +1,33 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo.tests.common import SavepointCase + + +class TestPartnerTitle(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + + def test_default_order(self): + partner_titles = self.env["res.partner.title"].search([]) + self.assertEqual( + partner_titles.mapped("name"), + partner_titles.sorted(lambda x: x.name).mapped("name"), + ) + + def test_sequence_order(self): + partner_titles = self.env["res.partner.title"].search([]) + partner_first = partner_titles[0] + partner_first.sequence = 100 + partner_last = partner_titles[-1] + partner_last.sequence = 0 + partner_titles = self.env["res.partner.title"].search([]) + self.assertEqual( + partner_titles.mapped("name"), + partner_titles.sorted(lambda x: (x.sequence, x.name)).mapped("name"), + ) + # last and first inverted + self.assertEqual(partner_titles[0], partner_last) + self.assertEqual(partner_titles[-1], partner_first) diff --git a/partner_title_order/views/res_partner_title_views.xml b/partner_title_order/views/res_partner_title_views.xml new file mode 100644 index 000000000000..c4217d2539f7 --- /dev/null +++ b/partner_title_order/views/res_partner_title_views.xml @@ -0,0 +1,26 @@ + + + + + + res.partner.title + + + + + + + + + + res.partner.title + + + + + + + + + From ef4299dbf88ff1ea87a57a430bf06d6388131b54 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Tue, 2 Nov 2021 11:42:18 +0000 Subject: [PATCH 02/11] [UPD] Update partner_title_order.pot --- .../i18n/partner_title_order.pot | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 partner_title_order/i18n/partner_title_order.pot diff --git a/partner_title_order/i18n/partner_title_order.pot b/partner_title_order/i18n/partner_title_order.pot new file mode 100644 index 000000000000..4739e6f414fe --- /dev/null +++ b/partner_title_order/i18n/partner_title_order.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_title_order +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_title_order +#: model:ir.model.fields,field_description:partner_title_order.field_res_partner_title__display_name +msgid "Display Name" +msgstr "" + +#. module: partner_title_order +#: model:ir.model.fields,field_description:partner_title_order.field_res_partner_title__id +msgid "ID" +msgstr "" + +#. module: partner_title_order +#: model:ir.model.fields,field_description:partner_title_order.field_res_partner_title____last_update +msgid "Last Modified on" +msgstr "" + +#. module: partner_title_order +#: model:ir.model,name:partner_title_order.model_res_partner_title +msgid "Partner Title" +msgstr "" + +#. module: partner_title_order +#: model:ir.model.fields,field_description:partner_title_order.field_res_partner_title__sequence +msgid "Sequence" +msgstr "" From 93e6a34df89d849d334dadd59784cc958fbd9f29 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 2 Nov 2021 12:14:28 +0000 Subject: [PATCH 03/11] [UPD] README.rst --- partner_title_order/static/description/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partner_title_order/static/description/index.html b/partner_title_order/static/description/index.html index a6b5cdb5ca01..d34a0b58e480 100644 --- a/partner_title_order/static/description/index.html +++ b/partner_title_order/static/description/index.html @@ -3,7 +3,7 @@ - + Partner title order