diff --git a/rma_sale_reason/README.rst b/rma_sale_reason/README.rst new file mode 100644 index 000000000..da418f0cd --- /dev/null +++ b/rma_sale_reason/README.rst @@ -0,0 +1,101 @@ +=============== +Rma Sale Reason +=============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:cbc6042f5078d432134c3bb0f3aa3ca2eaaca763041004ab982997f8f44b9a58 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Frma-lightgray.png?logo=github + :target: https://github.com/OCA/rma/tree/16.0/rma_sale_reason + :alt: OCA/rma +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/rma-16-0/rma-16-0-rma_sale_reason + :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/rma&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Getting the information as soon as possible is crucial for any business. +That's why, when creating an RMA order from a sales order, it's more +efficient to give the salesperson the possibility to record the return +reason instead of waiting for the RMA team to do it when they process +the order. This ensures accurate recording of customer issues and +improves data accuracy. + +This addon is an extension of the rma_sale and rma_reason addons. It +allows salespersons to specify the return reason when creating the RMA +order from the sales order. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +When creating an RMA from a sale order select the reason for the return. + +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 +------- + +* Raumschmiede GmbH +* BCIM +* ACSONE SA/NV + +Contributors +------------ + +- Jacques-Etienne Baudoux - BCIM je@bcim.be +- Souheil Bejaoui - ACSONE SA/NV souheil.bejaoui@acsone.eu.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. + +.. |maintainer-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px + :target: https://github.com/sbejaoui + :alt: sbejaoui + +Current `maintainer `__: + +|maintainer-sbejaoui| + +This module is part of the `OCA/rma `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/rma_sale_reason/__init__.py b/rma_sale_reason/__init__.py new file mode 100644 index 000000000..5cb1c4914 --- /dev/null +++ b/rma_sale_reason/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/rma_sale_reason/__manifest__.py b/rma_sale_reason/__manifest__.py new file mode 100644 index 000000000..726507b8b --- /dev/null +++ b/rma_sale_reason/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2024 Raumschmiede GmbH +# Copyright 2024 BCIM +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Rma Sale Reason", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Raumschmiede GmbH,BCIM,ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/rma", + "depends": ["rma_sale", "rma_reason"], + "maintainers": ["sbejaoui"], + "data": [ + "wizards/sale_order_rma_wizard.xml", + ], + "demo": [], +} diff --git a/rma_sale_reason/readme/CONTRIBUTORS.md b/rma_sale_reason/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..354d493cf --- /dev/null +++ b/rma_sale_reason/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jacques-Etienne Baudoux - BCIM +- Souheil Bejaoui - ACSONE SA/NV diff --git a/rma_sale_reason/readme/DESCRIPTION.md b/rma_sale_reason/readme/DESCRIPTION.md new file mode 100644 index 000000000..a968ce67e --- /dev/null +++ b/rma_sale_reason/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +Getting the information as soon as possible is crucial for any business. +That's why, when creating an RMA order from a sales order, +it's more efficient to give the salesperson the possibility to record the +return reason instead of waiting for the RMA team to do it when they process +the order. This ensures accurate recording of customer issues and improves +data accuracy. + +This addon is an extension of the rma_sale and rma_reason addons. +It allows salespersons to specify the return reason when creating the RMA +order from the sales order. diff --git a/rma_sale_reason/readme/USAGE.md b/rma_sale_reason/readme/USAGE.md new file mode 100644 index 000000000..9a9da63d6 --- /dev/null +++ b/rma_sale_reason/readme/USAGE.md @@ -0,0 +1 @@ +When creating an RMA from a sale order select the reason for the return. diff --git a/rma_sale_reason/static/description/icon.png b/rma_sale_reason/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/rma_sale_reason/static/description/icon.png differ diff --git a/rma_sale_reason/static/description/index.html b/rma_sale_reason/static/description/index.html new file mode 100644 index 000000000..a8a849dd8 --- /dev/null +++ b/rma_sale_reason/static/description/index.html @@ -0,0 +1,438 @@ + + + + + +Rma Sale Reason + + + +
+

Rma Sale Reason

+ + +

Beta License: AGPL-3 OCA/rma Translate me on Weblate Try me on Runboat

+

Getting the information as soon as possible is crucial for any business. +That’s why, when creating an RMA order from a sales order, it’s more +efficient to give the salesperson the possibility to record the return +reason instead of waiting for the RMA team to do it when they process +the order. This ensures accurate recording of customer issues and +improves data accuracy.

+

This addon is an extension of the rma_sale and rma_reason addons. It +allows salespersons to specify the return reason when creating the RMA +order from the sales order.

+

Table of contents

+ +
+

Usage

+

When creating an RMA from a sale order select the reason for the return.

+
+
+

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

+
    +
  • Raumschmiede GmbH
  • +
  • BCIM
  • +
  • ACSONE SA/NV
  • +
+
+
+

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.

+

Current maintainer:

+

sbejaoui

+

This module is part of the OCA/rma project on GitHub.

+

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

+
+
+
+ + diff --git a/rma_sale_reason/tests/__init__.py b/rma_sale_reason/tests/__init__.py new file mode 100644 index 000000000..4696ae6b1 --- /dev/null +++ b/rma_sale_reason/tests/__init__.py @@ -0,0 +1 @@ +from . import test_rma_sale_reason diff --git a/rma_sale_reason/tests/test_rma_sale_reason.py b/rma_sale_reason/tests/test_rma_sale_reason.py new file mode 100644 index 000000000..732f05eba --- /dev/null +++ b/rma_sale_reason/tests/test_rma_sale_reason.py @@ -0,0 +1,55 @@ +# Copyright 2024 Raumschmiede GmbH +# Copyright 2024 BCIM +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import Command +from odoo.tests.common import users + +from odoo.addons.rma_sale.tests.test_rma_sale_portal import TestRmaSaleBase + + +class TestRmaSaleReason(TestRmaSaleBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.rma_reason = cls.env["rma.reason"].create({"name": "defective product"}) + cls.sale_order = cls._create_sale_order(cls, [[cls.product_1, 5]]) + cls.sale_order.action_confirm() + cls.order_line = cls.sale_order.order_line.filtered( + lambda r: r.product_id == cls.product_1 + ) + cls.order_out_picking = cls.sale_order.picking_ids + cls.order_out_picking.move_ids.quantity_done = 5 + cls.order_out_picking.button_validate() + + @users("partner@rma") + def test_create_rma_from_wizard(self): + order = self.sale_order + wizard_obj = ( + self.env["sale.order.rma.wizard"].sudo().with_context(active_id=order.id) + ) + operation = self.rma_operation_model.sudo().search([], limit=1) + line_vals = [ + Command.create( + { + "product_id": order.order_line.product_id.id, + "sale_line_id": order.order_line.id, + "quantity": order.order_line.product_uom_qty, + "uom_id": order.order_line.product_uom.id, + "picking_id": order.picking_ids[0].id, + "operation_id": operation.id, + "reason_id": self.rma_reason.id, + }, + ) + ] + wizard = wizard_obj.create( + { + "line_ids": line_vals, + "location_id": order.warehouse_id.rma_loc_id.id, + } + ) + rma = wizard.sudo().create_rma(from_portal=True) + self.assertEqual(rma.order_id, order) + self.assertEqual(rma.reason_id, self.rma_reason) diff --git a/rma_sale_reason/wizards/__init__.py b/rma_sale_reason/wizards/__init__.py new file mode 100644 index 000000000..8efcbacda --- /dev/null +++ b/rma_sale_reason/wizards/__init__.py @@ -0,0 +1 @@ +from . import sale_order_line_rma_wizard diff --git a/rma_sale_reason/wizards/sale_order_line_rma_wizard.py b/rma_sale_reason/wizards/sale_order_line_rma_wizard.py new file mode 100644 index 000000000..78ae2ba77 --- /dev/null +++ b/rma_sale_reason/wizards/sale_order_line_rma_wizard.py @@ -0,0 +1,22 @@ +# Copyright 2024 Raumschmiede GmbH +# Copyright 2024 BCIM +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleOrderLineRmaWizard(models.TransientModel): + + _inherit = "sale.order.line.rma.wizard" + + reason_id = fields.Many2one(comodel_name="rma.reason") + is_rma_reason_required = fields.Boolean( + related="order_id.company_id.is_rma_reason_required" + ) + + def _prepare_rma_values(self): + values = super()._prepare_rma_values() + if self.reason_id: + values["reason_id"] = self.reason_id.id + return values diff --git a/rma_sale_reason/wizards/sale_order_rma_wizard.xml b/rma_sale_reason/wizards/sale_order_rma_wizard.xml new file mode 100644 index 000000000..dd3414ed6 --- /dev/null +++ b/rma_sale_reason/wizards/sale_order_rma_wizard.xml @@ -0,0 +1,24 @@ + + + + + + sale.order.rma.wizard + + + + + + + + + + + + diff --git a/setup/rma_sale_reason/odoo/addons/rma_sale_reason b/setup/rma_sale_reason/odoo/addons/rma_sale_reason new file mode 120000 index 000000000..ae60d2221 --- /dev/null +++ b/setup/rma_sale_reason/odoo/addons/rma_sale_reason @@ -0,0 +1 @@ +../../../../rma_sale_reason \ No newline at end of file diff --git a/setup/rma_sale_reason/setup.py b/setup/rma_sale_reason/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/rma_sale_reason/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)