diff --git a/setup/stock_location_route_description/odoo/addons/stock_location_route_description b/setup/stock_location_route_description/odoo/addons/stock_location_route_description new file mode 120000 index 000000000..91af86eae --- /dev/null +++ b/setup/stock_location_route_description/odoo/addons/stock_location_route_description @@ -0,0 +1 @@ +../../../../stock_location_route_description \ No newline at end of file diff --git a/setup/stock_location_route_description/setup.py b/setup/stock_location_route_description/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_location_route_description/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_location_route_description/README.rst b/stock_location_route_description/README.rst new file mode 100644 index 000000000..3f072c71d --- /dev/null +++ b/stock_location_route_description/README.rst @@ -0,0 +1,73 @@ +================================ +Stock Location Route Description +================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_location_route_description + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_location_route_description + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/153/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a field 'description' on stock location routes. + +**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 +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* Judith Almoño + +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/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_location_route_description/__init__.py b/stock_location_route_description/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_location_route_description/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_location_route_description/__manifest__.py b/stock_location_route_description/__manifest__.py new file mode 100644 index 000000000..042c8d915 --- /dev/null +++ b/stock_location_route_description/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +{ + "name": "Stock Location Route Description", + "version": "14.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "summary": "Add description field on stock routes.", + "category": "Stock Management", + "depends": ["stock"], + "data": ["views/stock_location_route_views.xml"], + "installable": True, + "license": "AGPL-3", +} diff --git a/stock_location_route_description/i18n/stock_location_route_description.pot b/stock_location_route_description/i18n/stock_location_route_description.pot new file mode 100644 index 000000000..8ebb2a9d8 --- /dev/null +++ b/stock_location_route_description/i18n/stock_location_route_description.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_route_description +# +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: stock_location_route_description +#: model:ir.model.fields,field_description:stock_location_route_description.field_stock_location_route__description +msgid "Description" +msgstr "" + +#. module: stock_location_route_description +#: model:ir.model,name:stock_location_route_description.model_stock_location_route +msgid "Inventory Routes" +msgstr "" diff --git a/stock_location_route_description/models/__init__.py b/stock_location_route_description/models/__init__.py new file mode 100644 index 000000000..77b390c14 --- /dev/null +++ b/stock_location_route_description/models/__init__.py @@ -0,0 +1 @@ +from . import stock_location_route diff --git a/stock_location_route_description/models/stock_location_route.py b/stock_location_route_description/models/stock_location_route.py new file mode 100644 index 000000000..f4c4aeb76 --- /dev/null +++ b/stock_location_route_description/models/stock_location_route.py @@ -0,0 +1,23 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class StockLocationRoute(models.Model): + _inherit = "stock.location.route" + + description = fields.Char(translate=True) + + def name_get(self): + if self.env.context.get("show_description", False): + result = [] + for rec in self: + name = "" + if rec.description: + name = rec.name + ": " + rec.description + else: + name = rec.name + result.append((rec.id, name)) + return result + return super().name_get() diff --git a/stock_location_route_description/readme/CONTRIBUTORS.rst b/stock_location_route_description/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..940587de9 --- /dev/null +++ b/stock_location_route_description/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Judith Almoño diff --git a/stock_location_route_description/readme/DESCRIPTION.rst b/stock_location_route_description/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0a8a84076 --- /dev/null +++ b/stock_location_route_description/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds a field 'description' on stock location routes. diff --git a/stock_location_route_description/static/description/icon.png b/stock_location_route_description/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_location_route_description/static/description/icon.png differ diff --git a/stock_location_route_description/static/description/index.html b/stock_location_route_description/static/description/index.html new file mode 100644 index 000000000..c03ae83da --- /dev/null +++ b/stock_location_route_description/static/description/index.html @@ -0,0 +1,419 @@ + + + + + + +Stock Location Route Description + + + +
+

Stock Location Route Description

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

This module adds a field ‘description’ on stock location routes.

+

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

+
    +
  • ForgeFlow
  • +
+
+
+

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.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_location_route_description/tests/__init__.py b/stock_location_route_description/tests/__init__.py new file mode 100644 index 000000000..85291b3f0 --- /dev/null +++ b/stock_location_route_description/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_location_route_description diff --git a/stock_location_route_description/tests/test_stock_location_route_description.py b/stock_location_route_description/tests/test_stock_location_route_description.py new file mode 100644 index 000000000..f48263047 --- /dev/null +++ b/stock_location_route_description/tests/test_stock_location_route_description.py @@ -0,0 +1,22 @@ +# Copyright 2022 ForgeFlow S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestStockLocationRouteDescription(TransactionCase): + def setUp(self, *args, **kwargs): + super(TestStockLocationRouteDescription, self).setUp(*args, **kwargs) + self.model_stock_location_route = self.env["stock.location.route"] + + def test_display_name_stock_location_route(self): + """ + Test to display the name of the route with and without a context. + """ + route = self.model_stock_location_route.create( + {"name": "Test Route", "description": "Test Description"} + ) + self.assertEqual(route.display_name, route.name) + name_description = route.name + ": " + route.description + route.with_context(show_description=True)._compute_display_name() + self.assertEqual(route.display_name, name_description) diff --git a/stock_location_route_description/views/stock_location_route_views.xml b/stock_location_route_description/views/stock_location_route_views.xml new file mode 100644 index 000000000..5088d68b5 --- /dev/null +++ b/stock_location_route_description/views/stock_location_route_views.xml @@ -0,0 +1,15 @@ + + + + stock.location.route.form - stock_location_route_description + stock.location.route + + + + + + + +