Skip to content

Commit ada04d0

Browse files
committed
[18.0][ADD] rma_batch_sale_auto_detect
This module extends the batch RMA process by adding automatic sale order linking at batch level. It reuses the matching logic provided by the module `rma_sale_auto_detect`, but allows it to be executed on all RMAs contained inside an `rma.batch`. A new batch state **Manual Treatment** is introduced. If at least one RMA in the batch fails to auto-match, the batch is moved to this state, so the user can review and fix the unmatched RMAs manually. refs: #473 [IMP] rma_batch_sale_auto_detect: allow user to select product then so in batch view
1 parent 47fdd22 commit ada04d0

File tree

14 files changed

+694
-0
lines changed

14 files changed

+694
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
==========================
2+
Rma Batch Sale Auto Detect
3+
==========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:b39e6390c06d804b6d4e843a4949f6921d1f541ec02c505df8f2a788315a1ed9
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github
20+
:target: https://github.com/OCA/rma/tree/18.0/rma_batch_sale_auto_detect
21+
:alt: OCA/rma
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/rma-18-0/rma-18-0-rma_batch_sale_auto_detect
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/rma&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends the batch RMA process by adding automatic sale order
32+
linking at batch level. It reuses the matching logic provided by the
33+
module ``rma_sale_auto_detect``, but allows it to be executed on all
34+
RMAs contained inside an ``rma.batch``.
35+
36+
| A new batch state **Manual Treatment** is introduced.
37+
| If at least one RMA in the batch fails to auto-match, the batch is
38+
moved to this state, so the user can review and fix the unmatched RMAs
39+
manually.
40+
41+
**Table of contents**
42+
43+
.. contents::
44+
:local:
45+
46+
Bug Tracker
47+
===========
48+
49+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/issues>`_.
50+
In case of trouble, please check there if your issue has already been reported.
51+
If you spotted it first, help us to smash it by providing a detailed and welcomed
52+
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_batch_sale_auto_detect%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
53+
54+
Do not contact contributors directly about support or help with technical issues.
55+
56+
Credits
57+
=======
58+
59+
Authors
60+
-------
61+
62+
* ACSONE SA/NV
63+
64+
Contributors
65+
------------
66+
67+
- Souheil Bejaoui [email protected]
68+
69+
Maintainers
70+
-----------
71+
72+
This module is maintained by the OCA.
73+
74+
.. image:: https://odoo-community.org/logo.png
75+
:alt: Odoo Community Association
76+
:target: https://odoo-community.org
77+
78+
OCA, or the Odoo Community Association, is a nonprofit organization whose
79+
mission is to support the collaborative development of Odoo features and
80+
promote its widespread use.
81+
82+
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/18.0/rma_batch_sale_auto_detect>`_ project on GitHub.
83+
84+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2025 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Rma Batch Sale Auto Detect",
6+
"summary": """This addon add an action to rma batch automatically detect rmas sale
7+
order""",
8+
"version": "18.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/rma",
12+
"depends": ["rma_batch", "rma_sale_auto_detect"],
13+
"data": ["views/rma_batch.xml"],
14+
"demo": [],
15+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import rma_batch
2+
from . import rma
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class Rma(models.Model):
8+
_inherit = "rma"
9+
10+
def _onchange_order_id(self):
11+
# allow user to select product then so in batch view
12+
if not self.env.context.get("ignore_onchange_order_id", False):
13+
return super()._onchange_order_id()
14+
return {}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2025 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class RmaBatch(models.Model):
8+
_inherit = "rma.batch"
9+
10+
state = fields.Selection(
11+
selection_add=[("manual", "Manual Treatment")],
12+
help=(
13+
"Represents the preparation and validation progress of the RMA batch:\n"
14+
"- Draft: RMAs are being prepared\n"
15+
"- Manual Treatment: One or more RMAs require manual matching\n"
16+
"- Ready: All RMAs are completed and batch is ready to be confirmed\n"
17+
"- Confirmed: The batch is validated and all RMAs are confirmed\n"
18+
"- Cancelled: The batch is cancelled"
19+
),
20+
)
21+
22+
def action_link_rma_to_sale_line(self):
23+
self.rma_ids.action_link_rma_to_sale_line()
24+
25+
def action_ready(self):
26+
res = super().action_ready()
27+
self.rma_ids.has_sale_auto_detect_issue = False
28+
self.action_link_rma_to_sale_line()
29+
for rec in self:
30+
if any(rec.rma_ids.mapped("has_sale_auto_detect_issue")):
31+
rec.state = "manual"
32+
return res
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Souheil Bejaoui <[email protected]>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This module extends the batch RMA process by adding automatic sale order
2+
linking at batch level. It reuses the matching logic provided by the module
3+
`rma_sale_auto_detect`, but allows it to be executed on all RMAs contained
4+
inside an `rma.batch`.
5+
6+
A new batch state **Manual Treatment** is introduced.
7+
If at least one RMA in the batch fails to auto-match, the batch is moved to
8+
this state, so the user can review and fix the unmatched RMAs manually.
9.23 KB
Loading

0 commit comments

Comments
 (0)