Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] rma: Migration to 16.0 #361

Merged
merged 76 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0122a02
[ADD] rma: new module
May 13, 2020
540da00
Added translation using Weblate (Portuguese (Brazil))
fcolus Jul 22, 2020
863a025
[FIX+IMP] rma: view permissions + portal views access errors + teams …
chienandalu Aug 14, 2020
343b164
[FIX+IMP] rma, rma_sale: fix bugs and add improvements
Aug 19, 2020
edf0cd3
Translated using Weblate (Spanish)
pedrobaeza Aug 22, 2020
cd4d0aa
[FIX] rma: permissions for general users
chienandalu Aug 24, 2020
cd84830
[IMP] rma: Return created sequence on create_rma_index
pedrobaeza Aug 22, 2020
92d41f5
[IMP] rma_sale: portal improvents
chienandalu Aug 28, 2020
cedce07
[FIX] rma: Perform refund with proper view
pedrobaeza Sep 14, 2020
e5cf5f6
[IMP] rma: set rma to received on invoice delete + incoming picking t…
Sep 15, 2020
b3bcbba
[FIX+IMP] rma: usability + Translated using Weblate (Spanish) + 5 thi…
chienandalu Sep 30, 2020
15ee352
[IMP] rma: black, isort, prettier
Oct 23, 2020
099c9a3
[MIG] rma: Migration to 13.0
Oct 23, 2020
9d84b44
[IMP] rma: Add customer as suggested recipient
Dec 1, 2020
fc46537
Added translation using Weblate (Romanian)
dhongu Dec 11, 2020
c5eaae3
Added translation using Weblate (Dutch)
bosd Dec 13, 2020
ef4ac28
Added translation using Weblate (Chinese (Simplified))
dong-z Mar 21, 2021
02a2694
Translated using Weblate (Chinese (Simplified))
dong-z Mar 21, 2021
8e6a869
[IMP] rma: auto send confirmation email
chienandalu Feb 9, 2021
ce911ba
[IMP] rma_sale: prepare kits integration
chienandalu Nov 16, 2020
cda887d
[IMP] rma: automatic notification subtypes
chienandalu Mar 1, 2021
704649c
[IMP] rma, rma_sale: shipping address
chienandalu Nov 6, 2020
f6e896d
[FIX] rma: Set default source location for RMA created from scratch
Mar 4, 2021
6ff2973
[FIX] rma: tagged test
chienandalu May 5, 2021
adbe669
[IMP] rma: tags
chienandalu May 6, 2021
75e7517
[IMP] rma: black, isort, prettier
chafique-delli Jun 6, 2021
379a6c0
[MIG] rma: Migration to 14.0
chafique-delli Dec 4, 2020
4450bd1
[IMP] rma: notify reception to customer
chienandalu May 19, 2021
3e01644
[IMP] rma: public tags
chienandalu May 25, 2021
e12d0f6
[IMP] rma: allow to archive operation types
chienandalu Jul 14, 2021
89f6b2a
Remove useless archive/unarchive button on form views
florian-dacosta Jul 29, 2021
e843849
[FIX] rma: Propagate cancel_backorder argument
pedrobaeza Sep 19, 2021
c7108f5
[FIX] rma: default team and responsible
chienandalu Sep 23, 2021
fa8c137
[FIX] rma: Use Form to avoid UoM change invalid check
pedrobaeza Sep 6, 2021
4847f6a
[FIX] rma: return location
chienandalu Sep 23, 2021
bdc9c45
Added translation using Weblate (Portuguese)
pedrocs-exo Oct 28, 2021
d034b5d
Translated using Weblate (Portuguese)
pedrocs-exo Oct 28, 2021
18d9eac
Added translation using Weblate (Italian)
francesco-ooops Nov 23, 2021
e3750a3
[FIX] multi company error on rma location choice
florian-dacosta Dec 1, 2021
04a4978
Translated using Weblate (Italian)
SicurSam Dec 3, 2021
ca639c2
Translated using Weblate (Italian)
francesco-ooops Dec 10, 2021
c802435
[FIX] duplicate labels (category_id, uom_category_id) of rma())
Kev-Roche Jan 16, 2022
4463c9f
Translated using Weblate (Spanish)
xavigutipujol Jan 17, 2022
8d1e036
[FIX] rma: return wizard to_refund
chienandalu Jan 17, 2022
3a8e91d
[FIX] rma: Adjust hook for existing values
pedrobaeza Dec 18, 2021
98aba1a
[IMP] rma report: invoice and shipping address
chienandalu Jan 21, 2022
970f9a0
[IMP] rma: unplug test cases from declaration
chienandalu Jan 25, 2022
389ef57
[IMP] rma: finish RMA manually
chienandalu Jan 28, 2022
896631f
[FIX] Do not link reception and delivery move in case of RMA replacement
florian-dacosta Feb 7, 2022
52bd881
[FIX] rma: name column width in tree view
chienandalu Mar 15, 2022
fbd486f
Translated using Weblate (Italian)
francesco-ooops Mar 23, 2022
b046da0
Translated using Weblate (Italian)
SicurSam Mar 31, 2022
66b7959
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 31, 2022
be17d76
[14.0][FIX] rma_sale, fix action permission issues.
GSLabIt Apr 26, 2022
096fd42
[14.0][FIX] rma, fix permission for action
GSLabIt Apr 26, 2022
2719bf5
[FIX] rma: Allow manual finalization in wizard.
victoralmau May 4, 2022
8d29deb
Translated using Weblate (Italian)
francesco-ooops May 18, 2022
0e6148f
[FIX] rma: refund permissions
chienandalu Feb 17, 2022
e52f18b
[IMP] rma: optionally group returns to customer
chienandalu Mar 7, 2022
ad4bce5
[FIX] rma: Avoid set invoice_payment_term_id from partner default val…
victoralmau Jun 22, 2022
80f8fa8
Update translation files
oca-transbot Jun 29, 2022
ee545ae
[FIX] rma + rma_sale: Allow to create an RMA to a user with access_to…
victoralmau May 16, 2022
5afdeac
[MIG] rma: Migration to 15.0
Aug 10, 2022
10b1a19
[OU-ADD] rma: Add migration script.
victoralmau Aug 19, 2022
0c4bf6d
[IMP] rma: Use _prepare_home_portal_values() function.
victoralmau Sep 2, 2022
b909e1f
Added translation using Weblate (German)
Sep 26, 2022
4e0478c
[FIX] rma: multiple substitution moves
chienandalu Oct 26, 2022
e3fa817
Translated using Weblate (Italian)
primes2h Dec 1, 2022
f8f366e
[FIX] rma: avoid reopening a cancelled RMA when the reception is deleted
chienandalu Mar 9, 2023
474226c
Translated using Weblate (German)
Apr 5, 2023
40fa0a9
[FIX] rma: avoid refunding in picking return wizard
chienandalu Mar 21, 2023
a3f0da6
Translated using Weblate (Italian)
francesco-ooops Dec 29, 2022
dd12157
Translated using Weblate (Italian)
mymage Dec 20, 2022
160dd58
Translated using Weblate (Spanish)
CarlosRoca13 Aug 11, 2023
c093db1
[IMP] rma: pre-commit stuff
pedrobaeza Aug 24, 2023
ed3f242
[MIG] rma: Migration to 16.0
pedrobaeza Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions rma/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
===========================================
Return Merchandise Authorization Management
===========================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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
: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
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/rma&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows you to manage `Return Merchandise Authorization (RMA)
<https://en.wikipedia.org/wiki/Return_merchandise_authorization>`_.
RMA documents can be created from scratch, from a delivery order or from
an incoming email. Product receptions and returning delivery operations
of the RMA module are fully integrated with the Receipts and Deliveries
Operations of Odoo inventory core module. It also allows you to generate
refunds in the same way as Odoo generates it.
Besides, you have full integration of the RMA documents in the customer portal.

**Table of contents**

.. contents::
:local:

Configuration
=============

If you want RMAs to be created from incoming emails, you need to:

#. Go to *Settings > General Settings*.
#. Check 'External Email Servers' checkbox under *Discuss* section.
#. Set an 'alias domain' and an incoming server.
#. Go to *RMA > Configuration > RMA Team* and select a team or create a new
one.
#. Go to 'Email' tab and set an 'Email Alias'.

If you want to manually finish RMAs, you need to:

#. Go to *Settings > Inventory*.
#. Set *Finish RMAs manually* checkbox on.

By default, returns to customer are grouped by shipping address, warehouse and company.
If you want to avoid this grouping you can:

#. Go to *Settings > Inventory*.
#. Set *Group RMA returns by customer address and warehouse* checkbox off.

The users will still be able to group those pickings from the wizard.

Usage
=====

To use this module, you need to:

#. Go to *RMA > Orders* and create a new RMA.
#. Select a partner, an invoice address, select a product
(or select a picking and a move instead), write a quantity, fill the rest
of the form and click on 'confirm' button in the status bar.
#. You will see an smart button labeled 'Receipt'. Click on that button to see
the reception operation form.
#. If everything is right, validate the operation and go back to the RMA to
see it in a 'received' state.
#. Now you are able to generate a refund, generate a delivery order to return
to the customer the same product or another product as a replacement, split
the RMA by extracting a part of the remaining quantity to another RMA,
preview the RMA in the website. All of these operations can be done by
clicking on the buttons in the status bar.

* If you click on 'Refund' button, a refund will be created, and it will be
accessible via the smart button labeled Refund. The RMA will be set
automatically to 'Refunded' state when the refund is validated.
* If you click on 'Replace' or 'Return to customer' button instead,
a popup wizard will guide you to create a Delivery order to the client
and this order will be accessible via the smart button labeled Delivery.
The RMA will be set automatically to 'Replaced' or 'Returned' state when
the RMA quantity is equal or lower than the quantity in done delivery
orders linked to it.
#. You can also finish the RMA without further ado. To do so click on the *Finish*
button. A wizard will ask you for the reason from a selection of preconfigured ones.
Be sure to configure them in advance on *RMA > Configuration > Finalization Reasons*.
Once the RMA is finished, it will be set to that state and the reason will be
registered.

An RMA can also be created from a return of a delivery order:

#. Select a delivery order and click on 'Return' button to create a return.
#. Check "Create RMAs" checkbox in the returning wizard, select the RMA
stock location and click on 'Return' button.
#. An RMA will be created for each product returned in the previous step.
Every RMA will be in confirmed state and they will
be linked to the returning operation generated previously.

There are Optional RMA Teams that can be used for:

- Organize RMAs in sections.
- Subscribe users to notifications.
- Create RMAs from incoming mail to special aliases (See configuration
section).

To create an RMA Team (RMA Responsible user level required):

#. Go to *RMA > Configuration > RMA Teams*
#. Create a new team and assign a name, a responsible and members.
#. Subscribe users to notifications, that can be of these subtypes:

- RMA draft. When a new RMA is created.
- Notes, Debates, Activities. As in standard Odoo.
#. In the list view, use the cross handle to sort RMA Teams. The top team
will be the default one if no team is set.

Known issues / Roadmap
======================

* As soon as the picking is selected, the user should select the move,
but perhaps stock.move _rec_name could be improved to better show what
the product of that move is.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/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 <https://github.com/OCA/rma/issues/new?body=module:%20rma%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Ernesto Tejeda
* Pedro M. Baeza
* David Vidal
* Víctor Martínez

* Chafique Delli <chafique.delli@akretion.com>
* Giovanni Serra - Ooops <giovanni@ooops404.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-ernestotejeda| image:: https://github.com/ernestotejeda.png?size=40px
:target: https://github.com/ernestotejeda
:alt: ernestotejeda

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ernestotejeda|

This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/16.0/rma>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 6 additions & 0 deletions rma/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import controllers
from . import models
from . import wizard
from .hooks import post_init_hook
41 changes: 41 additions & 0 deletions rma/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# Copyright 2021-2023 Tecnativa - David Vidal
# Copyright 2021-2023 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Return Merchandise Authorization Management",
"summary": "Return Merchandise Authorization (RMA)",
"version": "16.0.1.0.0",
"development_status": "Production/Stable",
"category": "RMA",
"website": "https://github.com/OCA/rma",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["pedrobaeza"],
"license": "AGPL-3",
"depends": ["stock_account"],
"data": [
"views/report_rma.xml",
"report/report.xml",
"data/mail_data.xml",
"data/rma_operation_data.xml",
"data/stock_data.xml",
"security/rma_security.xml",
"security/ir.model.access.csv",
"wizard/stock_picking_return_views.xml",
"wizard/rma_delivery_views.xml",
"wizard/rma_finalization_wizard_views.xml",
"wizard/rma_split_views.xml",
"views/menus.xml",
"views/res_partner_views.xml",
"views/rma_finalization_views.xml",
"views/rma_portal_templates.xml",
"views/rma_team_views.xml",
"views/rma_views.xml",
"views/rma_tag_views.xml",
"views/stock_picking_views.xml",
"views/stock_warehouse_views.xml",
"views/res_config_settings_views.xml",
],
"post_init_hook": "post_init_hook",
"application": True,
}
3 changes: 3 additions & 0 deletions rma/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import main
144 changes: 144 additions & 0 deletions rma/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, exceptions, http
from odoo.exceptions import AccessError, MissingError
from odoo.http import request
from odoo.tools import consteq

from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager


class PortalRma(CustomerPortal):
def _prepare_home_portal_values(self, counters):
values = super()._prepare_home_portal_values(counters)
if "rma_count" in counters:
rma_model = request.env["rma"]
rma_count = (
rma_model.search_count([])
if rma_model.check_access_rights("read", raise_exception=False)
else 0
)
values["rma_count"] = rma_count
return values

def _rma_get_page_view_values(self, rma, access_token, **kwargs):
values = {
"page_name": "RMA",
"rma": rma,
}
return self._get_page_view_values(
rma, access_token, values, "my_rmas_history", False, **kwargs
)

def _get_filter_domain(self, kw):
return []

@http.route(
["/my/rmas", "/my/rmas/page/<int:page>"], type="http", auth="user", website=True
)
def portal_my_rmas(self, page=1, date_begin=None, date_end=None, sortby=None, **kw):
values = self._prepare_portal_layout_values()
rma_obj = request.env["rma"]
# Avoid error if the user does not have access.
if not rma_obj.check_access_rights("read", raise_exception=False):
return request.redirect("/my")
domain = self._get_filter_domain(kw)
searchbar_sortings = {
"date": {"label": _("Date"), "order": "date desc"},
"name": {"label": _("Name"), "order": "name desc"},
"state": {"label": _("Status"), "order": "state"},
}
# default sort by order
if not sortby:
sortby = "date"
order = searchbar_sortings[sortby]["order"]
if date_begin and date_end:
domain += [
("create_date", ">", date_begin),
("create_date", "<=", date_end),
]
# count for pager
rma_count = rma_obj.search_count(domain)
# pager
pager = portal_pager(
url="/my/rmas",
url_args={
"date_begin": date_begin,
"date_end": date_end,
"sortby": sortby,
},
total=rma_count,
page=page,
step=self._items_per_page,
)
# content according to pager and archive selected
rmas = rma_obj.search(
domain, order=order, limit=self._items_per_page, offset=pager["offset"]
)
request.session["my_rmas_history"] = rmas.ids[:100]
values.update(
{
"date": date_begin,
"rmas": rmas,
"page_name": "RMA",
"pager": pager,
"default_url": "/my/rmas",
"searchbar_sortings": searchbar_sortings,
"sortby": sortby,
}
)
return request.render("rma.portal_my_rmas", values)

@http.route(["/my/rmas/<int:rma_id>"], type="http", auth="public", website=True)
def portal_my_rma_detail(
self, rma_id, access_token=None, report_type=None, download=False, **kw
):
try:
rma_sudo = self._document_check_access("rma", rma_id, access_token)
except (AccessError, MissingError):
return request.redirect("/my")
if report_type in ("html", "pdf", "text"):
return self._show_report(
model=rma_sudo,
report_type=report_type,
report_ref="rma.report_rma_action",
download=download,
)

values = self._rma_get_page_view_values(rma_sudo, access_token, **kw)
return request.render("rma.portal_rma_page", values)

@http.route(
["/my/rma/picking/pdf/<int:rma_id>/<int:picking_id>"],
type="http",
auth="public",
website=True,
)
def portal_my_rma_picking_report(self, rma_id, picking_id, access_token=None, **kw):
try:
picking_sudo = self._picking_check_access(
rma_id, picking_id, access_token=access_token
)
except exceptions.AccessError:
return request.redirect("/my")
report_sudo = request.env.ref("stock.action_report_delivery").sudo()
pdf = report_sudo._render_qweb_pdf([picking_sudo.id])[0]
pdfhttpheaders = [
("Content-Type", "application/pdf"),
("Content-Length", len(pdf)),
]
return request.make_response(pdf, headers=pdfhttpheaders)

def _picking_check_access(self, rma_id, picking_id, access_token=None):
rma = request.env["rma"].browse([rma_id])
picking = request.env["stock.picking"].browse([picking_id])
picking_sudo = picking.sudo()
try:
picking.check_access_rights("read")
picking.check_access_rule("read")
except exceptions.AccessError:
if not access_token or not consteq(rma.access_token, access_token):
raise
return picking_sudo
Loading