Skip to content

Commit

Permalink
Merge PR #447 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Feb 12, 2025
2 parents 994d480 + 0c76b7e commit 634e0d7
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 124 deletions.
66 changes: 34 additions & 32 deletions rma/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ To use this module, you need to:
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 'To 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.
- If you click on 'To 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.

6. 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
Expand All @@ -117,32 +117,32 @@ An RMA can also be created from a return of a delivery order:

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).
- 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):

1. Go to *RMA > Configuration > RMA Teams*
2. Create a new team and assign a name, a responsible and members.
3. 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.
- RMA draft. When a new RMA is created.
- Notes, Debates, Activities. As in standard Odoo.

4. 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.
- Add RMA reception and/or RMA delivery on several steps - 2 or 3 - like
normal receptions/deliveries. It should be a separate option inside
the warehouse definition.
- 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.
- Add RMA reception and/or RMA delivery on several steps - 2 or 3 -
like normal receptions/deliveries. It should be a separate option
inside the warehouse definition.

Bug Tracker
===========
Expand All @@ -165,20 +165,22 @@ Authors
Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

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

- Chafique Delli <[email protected]>
- Giovanni Serra - Ooops <[email protected]>
- `APSL-Nagarro <https://www.apsl.tech>`__:
- Chafique Delli <[email protected]>
- Giovanni Serra - Ooops <[email protected]>
- `APSL-Nagarro <https://www.apsl.tech>`__:

- Antoni Marroig <[email protected]>
- Antoni Marroig <[email protected]>

- Michael Tietz (MT Software) [email protected]
- Michael Tietz (MT Software) [email protected]
- Jacques-Etienne Baudoux - BCIM [email protected]
- Souheil Bejaoui - ACSONE SA/NV [email protected]

Maintainers
-----------
Expand Down
1 change: 1 addition & 0 deletions rma/models/rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ def _ensure_required_fields(self):
"partner_invoice_id",
"product_id",
"location_id",
"operation_id",
]
for record in self:
desc = ""
Expand Down
4 changes: 1 addition & 3 deletions rma/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class StockMove(models.Model):
)
# RMA that creates the out move
rma_id = fields.Many2one(
comodel_name="rma",
string="RMA return",
copy=False,
comodel_name="rma", string="RMA return", copy=False, index=True
)

def unlink(self):
Expand Down
2 changes: 2 additions & 0 deletions rma/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
- [APSL-Nagarro](https://www.apsl.tech):
- Antoni Marroig \<<[email protected]>\>
- Michael Tietz (MT Software) <[email protected]>
- Jacques-Etienne Baudoux - BCIM <[email protected]>
- Souheil Bejaoui - ACSONE SA/NV <[email protected]>
12 changes: 7 additions & 5 deletions rma/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
it will be accessible via the smart button labeled Refund. The RMA
will be set automatically to ‘Refunded’ state when the refund is
validated.</li>
<li>If you click on ‘Replace’ or ‘Return to customer’ button instead, a
popup wizard will guide you to create a Delivery order to the
<li>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
Expand Down Expand Up @@ -494,9 +494,9 @@ <h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<li>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.</li>
<li>Add RMA reception and/or RMA delivery on several steps - 2 or 3 - like
normal receptions/deliveries. It should be a separate option inside
the warehouse definition.</li>
<li>Add RMA reception and/or RMA delivery on several steps - 2 or 3 -
like normal receptions/deliveries. It should be a separate option
inside the warehouse definition.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
Expand Down Expand Up @@ -532,6 +532,8 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
</ul>
</li>
<li>Michael Tietz (MT Software) <a class="reference external" href="mailto:mtietz&#64;mt-software.de">mtietz&#64;mt-software.de</a></li>
<li>Jacques-Etienne Baudoux - BCIM <a class="reference external" href="mailto:je&#64;bcim.be">je&#64;bcim.be</a></li>
<li>Souheil Bejaoui - ACSONE SA/NV <a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a></li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
29 changes: 22 additions & 7 deletions rma/tests/test_rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ def setUpClass(cls):
cls.warehouse = cls.env.ref("stock.warehouse0")
# Ensure grouping
cls.env.company.rma_return_grouping = True
cls.operation = cls.env.ref("rma.rma_operation_replace")

def _create_rma(self, partner=None, product=None, qty=None, location=None):
def _create_rma(
self, partner=None, product=None, qty=None, location=None, operation=None
):
vals = {}
if partner:
vals["partner_id"] = partner.id
Expand All @@ -82,14 +85,17 @@ def _create_rma(self, partner=None, product=None, qty=None, location=None):
vals["product_uom_qty"] = qty
if location:
vals["location_id"] = location.id

if operation:
vals["operation_id"] = operation.id
elif operation is None:
vals["operation_id"] = self.operation.id
vals["user_id"] = self.env.user.id
return self.env["rma"].create(vals)

def _create_confirm_receive(
self, partner=None, product=None, qty=None, location=None
self, partner=None, product=None, qty=None, location=None, operation=None
):
rma = self._create_rma(partner, product, qty, location)
rma = self._create_rma(partner, product, qty, location, operation)
rma.action_confirm()
rma.reception_move_id.quantity = rma.product_uom_qty
rma.reception_move_id.picking_id.button_validate()
Expand Down Expand Up @@ -221,19 +227,26 @@ def test_computed(self):
self.assertEqual(rma.product_uom, self.product.uom_id)

def test_ensure_required_fields_on_confirm(self):
rma = self._create_rma()
rma = self._create_rma(operation=False)
with self.assertRaises(ValidationError) as e:
rma.action_confirm()
self.assertEqual(
e.exception.args[0],
"Required field(s):\nCustomer\nShipping Address\nInvoice Address\nProduct",
"Required field(s):\nCustomer\nShipping Address\nInvoice Address\nProduct"
"\nRequested operation",
)
rma.partner_id = self.partner.id
with self.assertRaises(ValidationError) as e:
rma.action_confirm()
self.assertEqual(e.exception.args[0], "Required field(s):\nProduct")
self.assertEqual(
e.exception.args[0], "Required field(s):\nProduct\nRequested operation"
)
rma.product_id = self.product.id
rma.location_id = self.rma_loc.id
with self.assertRaises(ValidationError) as e:
rma.action_confirm()
self.assertEqual(e.exception.args[0], "Required field(s):\nRequested operation")
rma.operation_id = self.operation
rma.action_confirm()
self.assertEqual(rma.state, "confirmed")

Expand Down Expand Up @@ -670,6 +683,7 @@ def test_rma_from_picking_return(self):
)
)
stock_return_picking_form.create_rma = True
stock_return_picking_form.rma_operation_id = self.operation
return_wizard = stock_return_picking_form.save()
picking_action = return_wizard.create_returns()
# Each origin move is linked to a different RMA
Expand Down Expand Up @@ -698,6 +712,7 @@ def test_split(self):
rma_form.move_id = origin_delivery.move_ids.filtered(
lambda r: r.product_id == self.product
)
rma_form.operation_id = self.operation
rma = rma_form.save()
rma.action_confirm()
rma.reception_move_id.quantity = 10
Expand Down
Loading

0 comments on commit 634e0d7

Please sign in to comment.