Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Available addons
addon | version | maintainers | summary
--- | --- | --- | ---
[product_warranty](product_warranty/) | 18.0.1.0.0 | <a href='https://github.com/osi-scampbell'><img src='https://github.com/osi-scampbell.png' width='32' height='32' style='border-radius:50%;' alt='osi-scampbell'/></a> <a href='https://github.com/max3903'><img src='https://github.com/max3903.png' width='32' height='32' style='border-radius:50%;' alt='max3903'/></a> | Product Warranty
[rma](rma/) | 18.0.2.4.2 | <a href='https://github.com/pedrobaeza'><img src='https://github.com/pedrobaeza.png' width='32' height='32' style='border-radius:50%;' alt='pedrobaeza'/></a> <a href='https://github.com/chienandalu'><img src='https://github.com/chienandalu.png' width='32' height='32' style='border-radius:50%;' alt='chienandalu'/></a> | Return Merchandise Authorization (RMA)
[rma](rma/) | 18.0.2.4.4 | <a href='https://github.com/pedrobaeza'><img src='https://github.com/pedrobaeza.png' width='32' height='32' style='border-radius:50%;' alt='pedrobaeza'/></a> <a href='https://github.com/chienandalu'><img src='https://github.com/chienandalu.png' width='32' height='32' style='border-radius:50%;' alt='chienandalu'/></a> | Return Merchandise Authorization (RMA)
[rma_batch](rma_batch/) | 18.0.1.0.0 | | Group RMAs into batches for collective management
[rma_delivery](rma_delivery/) | 18.0.1.4.1 | <a href='https://github.com/chienandalu'><img src='https://github.com/chienandalu.png' width='32' height='32' style='border-radius:50%;' alt='chienandalu'/></a> | Allow to choose a default delivery carrier for returns
[rma_lot](rma_lot/) | 18.0.1.3.0 | | Manage lot in RMA
Expand Down
2 changes: 1 addition & 1 deletion rma/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Return Merchandise Authorization Management
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6db2a3295eba4c42d659410a81781a5e7bce6c5e9dc4fe1bd318e1d276027d64
!! source digest: sha256:98f1ab47d6cb82658fe2c8ac1b539bd710f5119792a6ea57d694caff0d550226
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand Down
2 changes: 1 addition & 1 deletion rma/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Return Merchandise Authorization Management",
"summary": "Return Merchandise Authorization (RMA)",
"version": "18.0.2.4.2",
"version": "18.0.2.4.4",
"development_status": "Production/Stable",
"category": "RMA",
"website": "https://github.com/OCA/rma",
Expand Down
8 changes: 2 additions & 6 deletions rma/models/rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,7 @@ def _compute_can_be_replaced(self):
r.can_be_replaced = (
r.operation_id.action_create_delivery
in ("manual_after_receipt", "automatic_after_receipt")
and r.state
in [
"received",
"waiting_replacement",
"replaced",
]
and r.state == "received"
) or (
r.operation_id.action_create_delivery
in ("manual_on_confirm", "automatic_on_confirm")
Expand Down Expand Up @@ -995,6 +990,7 @@ def action_finish(self):
def action_cancel(self):
"""Invoked when 'Cancel' button in rma form view is clicked."""
self.reception_move_id._action_cancel()
self.delivery_move_ids._action_cancel()
self.write({"state": "cancelled"})

def action_draft(self):
Expand Down
2 changes: 1 addition & 1 deletion rma/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h1>Return Merchandise Authorization Management</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6db2a3295eba4c42d659410a81781a5e7bce6c5e9dc4fe1bd318e1d276027d64
!! source digest: sha256:98f1ab47d6cb82658fe2c8ac1b539bd710f5119792a6ea57d694caff0d550226
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rma/tree/18.0/rma"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rma-18-0/rma-18-0-rma"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rma&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to manage <a class="reference external" href="https://en.wikipedia.org/wiki/Return_merchandise_authorization">Return Merchandise Authorization
Expand Down
47 changes: 35 additions & 12 deletions rma/tests/test_rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def test_confirm_and_receive_and_return(self):
self.assertEqual(res["res_id"], new_rma.id)

@mute_logger("odoo.models.unlink")
def test_cancel(self):
def test_cancel_01(self):
# cancel a draft RMA
rma = self._create_rma(self.partner, self.product)
rma.action_cancel()
Expand All @@ -394,6 +394,27 @@ def test_cancel(self):
with self.assertRaises(UserError):
rma.action_cancel()

@mute_logger("odoo.models.unlink")
def test_cancel_02(self):
self.operation.action_create_delivery = "manual_on_confirm"
rma = self._create_rma(self.partner, self.product)
rma.action_confirm()
self.assertEqual(rma.state, "confirmed")
reception_picking = rma.reception_move_id.picking_id
self.assertEqual(reception_picking.state, "assigned")
res = rma.action_replace()
delivery_form = Form(self.env[res["res_model"]].with_context(**res["context"]))
delivery_form.product_id = self.product
delivery_wizard = delivery_form.save()
delivery_wizard.action_deliver()
self.assertEqual(rma.state, "waiting_replacement")
delivery_picking = rma.delivery_move_ids.picking_id
self.assertEqual(delivery_picking.state, "confirmed")
rma.action_cancel()
self.assertEqual(rma.state, "cancelled")
self.assertEqual(reception_picking.state, "cancel")
self.assertEqual(delivery_picking.state, "cancel")

def test_lock_unlock(self):
# A RMA is only locked from 'received' state
rma_1 = self._create_rma(self.partner, self.product, 10, self.rma_loc)
Expand Down Expand Up @@ -558,11 +579,15 @@ def test_replace(self):
self.assertEqual(rma.state, "waiting_replacement")
self.assertFalse(rma.can_be_refunded)
self.assertFalse(rma.can_be_returned)
self.assertTrue(rma.can_be_replaced)
self.assertFalse(rma.can_be_replaced)
self.assertEqual(rma.delivered_qty, 2)
self.assertEqual(rma.remaining_qty, 8)
first_move = rma.delivery_move_ids
picking = first_move.picking_id
picking.action_cancel()
self.assertEqual(picking.state, "cancel")
self.assertEqual(rma.state, "received")
self.assertTrue(rma.can_be_replaced)
# Replace again with another product with the remaining quantity
product_3 = self.product_product.create(
{"name": "Product 3 test", "type": "consu", "is_storable": True}
Expand All @@ -578,28 +603,26 @@ def test_replace(self):
delivery_wizard.action_deliver()
second_move = rma.delivery_move_ids - first_move
self.assertEqual(len(rma.delivery_move_ids), 2)
self.assertEqual(rma.delivery_move_ids.mapped("picking_id"), picking)
new_picking = second_move.picking_id
self.assertEqual(first_move.product_id, product_2)
self.assertEqual(first_move.product_uom_qty, 2)
self.assertEqual(second_move.product_id, product_3)
self.assertEqual(second_move.product_uom_qty, 8)
self.assertTrue(picking.state, "waiting")
self.assertEqual(second_move.product_uom_qty, 10)
self.assertTrue(new_picking.state, "waiting")
self.assertEqual(rma.delivered_qty, 10)
self.assertEqual(rma.remaining_qty, 0)
# remaining_qty is 0 but rma is not set to 'replaced' until
first_move.quantity = 2
second_move.quantity = 8
picking.button_validate()
self.assertEqual(picking.state, "done")
second_move.quantity = 10
new_picking.button_validate()
self.assertEqual(new_picking.state, "done")
self.assertEqual(rma.delivered_qty, 10)
self.assertEqual(rma.remaining_qty, 0)
# The RMA is now in 'replaced' state
self.assertEqual(rma.state, "replaced")
self.assertFalse(rma.can_be_refunded)
self.assertFalse(rma.can_be_returned)
# Despite being in 'replaced' state,
# RMAs can still perform replacements.
self.assertTrue(rma.can_be_replaced)
# RMAs can't still perform replacements.
self.assertFalse(rma.can_be_replaced)

def test_return_to_customer(self):
# Create, confirm and receive an RMA
Expand Down
2 changes: 1 addition & 1 deletion rma/tests/test_rma_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_06(self):
self.assertEqual(rma.state, "waiting_replacement")
self.assertFalse(rma.can_be_returned)
self.assertFalse(rma.show_create_return)
self.assertTrue(rma.can_be_replaced)
self.assertFalse(rma.can_be_replaced)
self.assertFalse(rma.show_create_replace)

def test_07(self):
Expand Down
Loading