diff --git a/repair_type_refurbish/README.rst b/repair_type_refurbish/README.rst new file mode 100644 index 00000000..28f64edf --- /dev/null +++ b/repair_type_refurbish/README.rst @@ -0,0 +1,94 @@ +===================== +Repair Type Refurbish +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:455a74b7100a644a45012f4bdd3b5661a8a141b46f7bea79d7a58b37db348fa7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Frepair-lightgray.png?logo=github + :target: https://github.com/OCA/repair/tree/15.0/repair_type_refurbish + :alt: OCA/repair +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/repair-15-0/repair-15-0-repair_type_refurbish + :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/repair&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Add the default refurbish locations to the repair type, same as repair type does with the standard location +fields. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +No configuration needed for this module. + +Usage +===== + +Go to Configuration>Repair Types and add the refurbish location. + +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 +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* `ForgeFlow `_: + + * Aaron Henriquez + +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/repair `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/repair_type_refurbish/__init__.py b/repair_type_refurbish/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/repair_type_refurbish/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/repair_type_refurbish/__manifest__.py b/repair_type_refurbish/__manifest__.py new file mode 100644 index 00000000..844b8ab5 --- /dev/null +++ b/repair_type_refurbish/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2023 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +{ + "name": "Repair Type Refurbish", + "version": "16.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/repair", + "summary": "Repair type", + "category": "Repair", + "depends": ["repair_type", "repair_refurbish"], + "data": [ + "views/repair_type.xml", + ], + "installable": True, + "development_status": "Alpha", + "license": "AGPL-3", +} diff --git a/repair_type_refurbish/i18n/repair_type_refurbish.pot b/repair_type_refurbish/i18n/repair_type_refurbish.pot new file mode 100644 index 00000000..f562b874 --- /dev/null +++ b/repair_type_refurbish/i18n/repair_type_refurbish.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_type_refurbish +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.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: repair_type_refurbish +#: model:ir.model.fields,field_description:repair_type_refurbish.field_repair_type__refurbish_location_dest_id +msgid "Refurbish destination Location" +msgstr "" + +#. module: repair_type_refurbish +#: model:ir.model.fields,field_description:repair_type_refurbish.field_repair_order__refurbish_location_dest_id +msgid "Refurbished Delivery Location" +msgstr "" + +#. module: repair_type_refurbish +#: model:ir.model,name:repair_type_refurbish.model_repair_order +msgid "Repair Order" +msgstr "" + +#. module: repair_type_refurbish +#: model:ir.model,name:repair_type_refurbish.model_repair_type +msgid "Repair Type" +msgstr "" + +#. module: repair_type_refurbish +#: model:ir.model.fields,help:repair_type_refurbish.field_repair_type__refurbish_location_dest_id +msgid "This is the location where the refurbished product will be send" +msgstr "" diff --git a/repair_type_refurbish/models/__init__.py b/repair_type_refurbish/models/__init__.py new file mode 100644 index 00000000..67781506 --- /dev/null +++ b/repair_type_refurbish/models/__init__.py @@ -0,0 +1,2 @@ +from . import repair +from . import repair_type diff --git a/repair_type_refurbish/models/repair.py b/repair_type_refurbish/models/repair.py new file mode 100644 index 00000000..381a8bb8 --- /dev/null +++ b/repair_type_refurbish/models/repair.py @@ -0,0 +1,20 @@ +# Copyright 2023 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import api, fields, models + + +class Repair(models.Model): + _inherit = "repair.order" + + refurbish_location_dest_id = fields.Many2one( + compute="_compute_refurbish_location_dest_id", store=True, readonly=False + ) + + @api.depends("repair_type_id") + def _compute_refurbish_location_dest_id(self): + for rec in self: + if rec.repair_type_id.refurbish_location_dest_id: + rec.refurbish_location_dest_id = ( + rec.repair_type_id.refurbish_location_dest_id + ) diff --git a/repair_type_refurbish/models/repair_type.py b/repair_type_refurbish/models/repair_type.py new file mode 100644 index 00000000..f705be4a --- /dev/null +++ b/repair_type_refurbish/models/repair_type.py @@ -0,0 +1,14 @@ +# Copyright 2023 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import fields, models + + +class RepairType(models.Model): + _inherit = "repair.type" + + refurbish_location_dest_id = fields.Many2one( + "stock.location", + "Refurbish destination Location", + help="This is the location where the refurbished product will be send", + ) diff --git a/repair_type_refurbish/readme/CONFIGURE.rst b/repair_type_refurbish/readme/CONFIGURE.rst new file mode 100644 index 00000000..029bb402 --- /dev/null +++ b/repair_type_refurbish/readme/CONFIGURE.rst @@ -0,0 +1 @@ +No configuration needed for this module. diff --git a/repair_type_refurbish/readme/CONTRIBUTORS.rst b/repair_type_refurbish/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..36c75380 --- /dev/null +++ b/repair_type_refurbish/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `ForgeFlow `_: + + * Aaron Henriquez diff --git a/repair_type_refurbish/readme/DESCRIPTION.rst b/repair_type_refurbish/readme/DESCRIPTION.rst new file mode 100644 index 00000000..654ca4e5 --- /dev/null +++ b/repair_type_refurbish/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Add the default refurbish locations to the repair type, same as repair type does with the standard location +fields. diff --git a/repair_type_refurbish/readme/USAGE.rst b/repair_type_refurbish/readme/USAGE.rst new file mode 100644 index 00000000..eb6f85d7 --- /dev/null +++ b/repair_type_refurbish/readme/USAGE.rst @@ -0,0 +1 @@ +Go to Configuration>Repair Types and add the refurbish location. diff --git a/repair_type_refurbish/static/description/icon.png b/repair_type_refurbish/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/repair_type_refurbish/static/description/icon.png differ diff --git a/repair_type_refurbish/static/description/index.html b/repair_type_refurbish/static/description/index.html new file mode 100644 index 00000000..4b536326 --- /dev/null +++ b/repair_type_refurbish/static/description/index.html @@ -0,0 +1,444 @@ + + + + + + +Repair Type Refurbish + + + +
+

Repair Type Refurbish

+ + +

Alpha License: AGPL-3 OCA/repair Translate me on Weblate Try me on Runboat

+

Add the default refurbish locations to the repair type, same as repair type does with the standard location +fields.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Configuration

+

No configuration needed for this module.

+
+
+

Usage

+

Go to Configuration>Repair Types and add the refurbish location.

+
+
+

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

+
    +
  • 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/repair project on GitHub.

+

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

+
+
+
+ + diff --git a/repair_type_refurbish/tests/__init__.py b/repair_type_refurbish/tests/__init__.py new file mode 100644 index 00000000..b66e17d4 --- /dev/null +++ b/repair_type_refurbish/tests/__init__.py @@ -0,0 +1 @@ +from . import test_repair_type diff --git a/repair_type_refurbish/tests/test_repair_type.py b/repair_type_refurbish/tests/test_repair_type.py new file mode 100644 index 00000000..2c684f91 --- /dev/null +++ b/repair_type_refurbish/tests/test_repair_type.py @@ -0,0 +1,53 @@ +# Copyright 2023 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo.tests.common import TransactionCase + + +class TestRepairType(TransactionCase): + def setUp(self, *args, **kwargs): + super(TestRepairType, self).setUp(*args, **kwargs) + + # First of all we create a repair to work with + self.repair_r1 = self.env.ref("repair.repair_r1") + + # Then, we create a repair type to know the source and destination locations + self.repair_type_1 = self.env["repair.type"].create( + { + "name": "Repairings refurbish to components", + "source_location_id": self.env.ref("stock.stock_location_stock").id, + "refurbish_location_dest_id": self.env.ref( + "stock.stock_location_components" + ).id, + } + ) + self.repair_type_2 = self.env["repair.type"].create( + { + "name": "Repairings refurbsih in stock", + "refurbish_location_dest_id": self.env.ref( + "stock.stock_location_stock" + ).id, + "source_location_id": self.env.ref( + "stock.stock_location_components" + ).id, + } + ) + + def test_compute_refurbish_location_id(self): + # First we associate the repair with the repair type + self.repair_r1.repair_type_id = self.repair_type_1 + + # Afterwards we will assert the source and + # destination of the product in the repair order + self.assertEqual( + self.repair_r1.refurbish_location_dest_id, + self.repair_type_1.refurbish_location_dest_id, + ) + + # We change the repair type to repair_type_2 and check if all the locations changed + self.repair_r1.repair_type_id = self.repair_type_2 + + self.assertEqual( + self.repair_r1.refurbish_location_dest_id, + self.repair_type_2.refurbish_location_dest_id, + ) diff --git a/repair_type_refurbish/views/repair_type.xml b/repair_type_refurbish/views/repair_type.xml new file mode 100644 index 00000000..460abb9e --- /dev/null +++ b/repair_type_refurbish/views/repair_type.xml @@ -0,0 +1,15 @@ + + + + + Repair Types Refurbish Form + repair.type + + + + + + + + + diff --git a/setup/repair_type_refurbish/odoo/addons/repair_type_refurbish b/setup/repair_type_refurbish/odoo/addons/repair_type_refurbish new file mode 120000 index 00000000..a985bfb8 --- /dev/null +++ b/setup/repair_type_refurbish/odoo/addons/repair_type_refurbish @@ -0,0 +1 @@ +../../../../repair_type_refurbish \ No newline at end of file diff --git a/setup/repair_type_refurbish/setup.py b/setup/repair_type_refurbish/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/repair_type_refurbish/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)