diff --git a/rma_reason/README.rst b/rma_reason/README.rst new file mode 100644 index 000000000..febe27a34 --- /dev/null +++ b/rma_reason/README.rst @@ -0,0 +1,113 @@ +========== +Rma 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_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_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| + +Specifying the RMA reason when creating an RMA order is crucial for +effective inventory management, quality control, and customer service. +It helps categorize returned items accurately, identify recurring +product issues, and improve overall product quality. This data enables +customer service to address issues more effectively and enhances the +customer experience. + +This addon allows RMA managers to pre-configure possible reasons users +can specify when creating the RMA order. + +In a multi-company setup, each company can define its own reasons and +choose to make the reason mandatory or optional. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +- Go to **Inventory > Settings > Settings** and select whether the + reason is mandatory or not. +- Go to **RMA > Settings > RMA Reasons** and create the RMA reasons for + your company. + +Usage +===== + +When creating an RMA, 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 + +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_reason/__init__.py b/rma_reason/__init__.py new file mode 100644 index 000000000..aee8895e7 --- /dev/null +++ b/rma_reason/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/rma_reason/__manifest__.py b/rma_reason/__manifest__.py new file mode 100644 index 000000000..48ef572e6 --- /dev/null +++ b/rma_reason/__manifest__.py @@ -0,0 +1,25 @@ +# 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 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"], + "maintainers": ["sbejaoui"], + "data": [ + "security/rma_reason.xml", + "views/rma.xml", + "views/rma_reason.xml", + "views/res_config_settings.xml", + "views/rma_portal_templates.xml", + "wizards/stock_return_picking.xml", + ], + "demo": [ + "demo/rma_reason.xml", + ], +} diff --git a/rma_reason/demo/rma_reason.xml b/rma_reason/demo/rma_reason.xml new file mode 100644 index 000000000..0463e8dc1 --- /dev/null +++ b/rma_reason/demo/rma_reason.xml @@ -0,0 +1,43 @@ + + + + + + Defective Product + The item is malfunctioning or has a defect that affects its intended use. + + + + Wrong Item Shipped + The customer received a different product than what they ordered. + + + + Damaged in Transit + The product was damaged during shipping and is not in usable condition upon arrival. + + + + Unwanted/Changed Mind + The customer no longer wants the item or changed their mind after purchasing it. + + + + Product Not as Described + The item does not match the description or specifications provided by the seller, leading to customer dissatisfaction. + + + diff --git a/rma_reason/models/__init__.py b/rma_reason/models/__init__.py new file mode 100644 index 000000000..ffaa311b3 --- /dev/null +++ b/rma_reason/models/__init__.py @@ -0,0 +1,4 @@ +from . import rma_reason +from . import rma +from . import res_company +from . import res_config_settings diff --git a/rma_reason/models/res_company.py b/rma_reason/models/res_company.py new file mode 100644 index 000000000..8c2eba692 --- /dev/null +++ b/rma_reason/models/res_company.py @@ -0,0 +1,16 @@ +# 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 ResCompany(models.Model): + + _inherit = "res.company" + + is_rma_reason_required = fields.Boolean( + string="Indicates whether specifying an RMA reason is mandatory when creating " + "an RMA order." + ) diff --git a/rma_reason/models/res_config_settings.py b/rma_reason/models/res_config_settings.py new file mode 100644 index 000000000..533f27959 --- /dev/null +++ b/rma_reason/models/res_config_settings.py @@ -0,0 +1,15 @@ +# 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 ResConfigSettings(models.TransientModel): + + _inherit = "res.config.settings" + + is_rma_reason_required = fields.Boolean( + related="company_id.is_rma_reason_required", readonly=False + ) diff --git a/rma_reason/models/rma.py b/rma_reason/models/rma.py new file mode 100644 index 000000000..7c9039395 --- /dev/null +++ b/rma_reason/models/rma.py @@ -0,0 +1,25 @@ +# 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 api, fields, models + + +class Rma(models.Model): + + _inherit = "rma" + + reason_id = fields.Many2one(comodel_name="rma.reason") + is_rma_reason_required = fields.Boolean(related="company_id.is_rma_reason_required") + operation_domain = fields.Binary(compute="_compute_operation_domain") + + @api.depends("reason_id") + def _compute_operation_domain(self): + for rec in self: + if rec.reason_id and rec.reason_id.allowed_operation_ids: + rec.operation_domain = [ + ("id", "in", rec.reason_id.allowed_operation_ids.ids) + ] + else: + rec.operation_domain = [] diff --git a/rma_reason/models/rma_reason.py b/rma_reason/models/rma_reason.py new file mode 100644 index 000000000..93a1d8f4a --- /dev/null +++ b/rma_reason/models/rma_reason.py @@ -0,0 +1,26 @@ +# 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 RmaReason(models.Model): + + _name = "rma.reason" + _description = "Rma Reason" + + name = fields.Char(required=True, translate=True) + description = fields.Text(translate=True) + company_id = fields.Many2one( + "res.company", + required=True, + readonly=True, + default=lambda self: self.env.company, + ) + allowed_operation_ids = fields.Many2many( + comodel_name="rma.operation", + string="Operations", + help="List of RMA operations that are allowed when this reason is selected.", + ) diff --git a/rma_reason/readme/CONFIGURE.md b/rma_reason/readme/CONFIGURE.md new file mode 100644 index 000000000..e37983d0a --- /dev/null +++ b/rma_reason/readme/CONFIGURE.md @@ -0,0 +1,4 @@ +To configure this module, you need to: + +- Go to **Inventory > Settings > Settings** and select whether the reason is mandatory or not. +- Go to **RMA > Settings > RMA Reasons** and create the RMA reasons for your company. diff --git a/rma_reason/readme/CONTRIBUTORS.md b/rma_reason/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..9e08567ce --- /dev/null +++ b/rma_reason/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jacques-Etienne Baudoux - BCIM +- Souheil Bejaoui - ACSONE SA/NV diff --git a/rma_reason/readme/DESCRIPTION.md b/rma_reason/readme/DESCRIPTION.md new file mode 100644 index 000000000..d5ff416d6 --- /dev/null +++ b/rma_reason/readme/DESCRIPTION.md @@ -0,0 +1,12 @@ +Specifying the RMA reason when creating an RMA order is crucial for effective +inventory management, quality control, and customer service. +It helps categorize returned items accurately, identify recurring product +issues, and improve overall product quality. This data enables customer +service to address issues more effectively and enhances the customer +experience. + +This addon allows RMA managers to pre-configure possible reasons users can +specify when creating the RMA order. + +In a multi-company setup, each company can define its own reasons and choose +to make the reason mandatory or optional. \ No newline at end of file diff --git a/rma_reason/readme/USAGE.md b/rma_reason/readme/USAGE.md new file mode 100644 index 000000000..b2cc51769 --- /dev/null +++ b/rma_reason/readme/USAGE.md @@ -0,0 +1 @@ +When creating an RMA, select the reason for the return. diff --git a/rma_reason/security/rma_reason.xml b/rma_reason/security/rma_reason.xml new file mode 100644 index 000000000..608576e14 --- /dev/null +++ b/rma_reason/security/rma_reason.xml @@ -0,0 +1,37 @@ + + + + + + rma.reason access rma user + + + + + + + + + + rma.reason access rma manager + + + + + + + + + + + RMA reason multi-company + + + ['|',('company_id','=',False),('company_id','in',company_ids)] + + diff --git a/rma_reason/static/description/icon.png b/rma_reason/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/rma_reason/static/description/icon.png differ diff --git a/rma_reason/static/description/index.html b/rma_reason/static/description/index.html new file mode 100644 index 000000000..e91875140 --- /dev/null +++ b/rma_reason/static/description/index.html @@ -0,0 +1,450 @@ + + + + + +Rma Reason + + + +
+

Rma Reason

+ + +

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

+

Specifying the RMA reason when creating an RMA order is crucial for +effective inventory management, quality control, and customer service. +It helps categorize returned items accurately, identify recurring +product issues, and improve overall product quality. This data enables +customer service to address issues more effectively and enhances the +customer experience.

+

This addon allows RMA managers to pre-configure possible reasons users +can specify when creating the RMA order.

+

In a multi-company setup, each company can define its own reasons and +choose to make the reason mandatory or optional.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  • Go to Inventory > Settings > Settings and select whether the +reason is mandatory or not.
  • +
  • Go to RMA > Settings > RMA Reasons and create the RMA reasons for +your company.
  • +
+
+
+

Usage

+

When creating an RMA, 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_reason/views/res_config_settings.xml b/rma_reason/views/res_config_settings.xml new file mode 100644 index 000000000..63e872ba8 --- /dev/null +++ b/rma_reason/views/res_config_settings.xml @@ -0,0 +1,43 @@ + + + + + + res.config.settings + + + +
+
+ +
+
+
+
+ +
+
+
+ + + +
diff --git a/rma_reason/views/rma.xml b/rma_reason/views/rma.xml new file mode 100644 index 000000000..e4569161d --- /dev/null +++ b/rma_reason/views/rma.xml @@ -0,0 +1,38 @@ + + + + + + rma + + + + + + + + + + + operation_domain + + + + + + rma + + + + + + + + + diff --git a/rma_reason/views/rma_portal_templates.xml b/rma_reason/views/rma_portal_templates.xml new file mode 100644 index 000000000..712849d34 --- /dev/null +++ b/rma_reason/views/rma_portal_templates.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/rma_reason/views/rma_reason.xml b/rma_reason/views/rma_reason.xml new file mode 100644 index 000000000..ecbf79e6b --- /dev/null +++ b/rma_reason/views/rma_reason.xml @@ -0,0 +1,59 @@ + + + + + + rma.reason + +
+ + + + + + + + +
+
+
+ + + rma.reason + + + + + + + + + + rma.reason + + + + + + + + + + RMA Reasons + rma.reason + tree,form + [] + {} + + + + RMA Reasons + + + + + +
diff --git a/rma_reason/wizards/__init__.py b/rma_reason/wizards/__init__.py new file mode 100644 index 000000000..18b78728a --- /dev/null +++ b/rma_reason/wizards/__init__.py @@ -0,0 +1,2 @@ +from . import stock_return_picking +from . import stock_return_picking_line diff --git a/rma_reason/wizards/stock_return_picking.py b/rma_reason/wizards/stock_return_picking.py new file mode 100644 index 000000000..ad2390f5e --- /dev/null +++ b/rma_reason/wizards/stock_return_picking.py @@ -0,0 +1,24 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class StockReturnPicking(models.TransientModel): + + _inherit = "stock.return.picking" + + rma_reason_id = fields.Many2one( + comodel_name="rma.reason", readonly=False, string="RMA Reason" + ) + rma_operation_domain = fields.Binary(compute="_compute_rma_operation_domain") + + @api.depends("rma_reason_id") + def _compute_rma_operation_domain(self): + for rec in self: + if rec.rma_reason_id and rec.rma_reason_id.allowed_operation_ids: + rec.rma_operation_domain = [ + ("id", "in", rec.rma_reason_id.allowed_operation_ids.ids) + ] + else: + rec.rma_operation_domain = [] diff --git a/rma_reason/wizards/stock_return_picking.xml b/rma_reason/wizards/stock_return_picking.xml new file mode 100644 index 000000000..0d4b75def --- /dev/null +++ b/rma_reason/wizards/stock_return_picking.xml @@ -0,0 +1,49 @@ + + + + + + stock.return.picking + + + + + + + + + rma_operation_domain + + + + + + + rma_operation_domain + + + + + + + + diff --git a/rma_reason/wizards/stock_return_picking_line.py b/rma_reason/wizards/stock_return_picking_line.py new file mode 100644 index 000000000..d2a5a78f8 --- /dev/null +++ b/rma_reason/wizards/stock_return_picking_line.py @@ -0,0 +1,43 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class StockReturnPickingLine(models.TransientModel): + + _inherit = "stock.return.picking.line" + + rma_reason_id = fields.Many2one( + comodel_name="rma.reason", + compute="_compute_rma_reason_id", + store=True, + readonly=False, + string="RMA Reason", + ) + is_rma_reason_required = fields.Boolean( + related="wizard_id.company_id.is_rma_reason_required" + ) + rma_operation_domain = fields.Binary(compute="_compute_rma_operation_domain") + + @api.depends("wizard_id.rma_reason_id") + def _compute_rma_reason_id(self): + for rec in self: + if rec.wizard_id.rma_reason_id: + rec.rma_reason_id = rec.wizard_id.rma_reason_id + + def _prepare_rma_vals(self): + self.ensure_one() + vals = super()._prepare_rma_vals() + vals["reason_id"] = self.rma_reason_id.id + return vals + + @api.depends("rma_reason_id") + def _compute_rma_operation_domain(self): + for rec in self: + if rec.rma_reason_id and rec.rma_reason_id.allowed_operation_ids: + rec.rma_operation_domain = [ + ("id", "in", rec.rma_reason_id.allowed_operation_ids.ids) + ] + else: + rec.rma_operation_domain = [] diff --git a/rma_sale/static/src/js/rma_portal_form.js b/rma_sale/static/src/js/rma_portal_form.js index 89e3d3103..d1b214bc3 100644 --- a/rma_sale/static/src/js/rma_portal_form.js +++ b/rma_sale/static/src/js/rma_portal_form.js @@ -132,4 +132,5 @@ odoo.define("rma_sale.animation", function (require) { $(ev.currentTarget).addClass("bg-primary").addClass("text-primary"); }, }); + return publicWidget; }); diff --git a/rma_sale/views/sale_portal_template.xml b/rma_sale/views/sale_portal_template.xml index d9196057f..f2367ae49 100644 --- a/rma_sale/views/sale_portal_template.xml +++ b/rma_sale/views/sale_portal_template.xml @@ -92,7 +92,10 @@ Product Quantity Delivery - Requested operation + Requested operation @@ -147,7 +150,7 @@ t-att-value="data['picking'] and data['picking'].id" /> - +