-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] rma_repair_put_away: glue module between rma_repair & rma_put_away
When not using rma_put_away you can define push rules anyway to move the products to the repair location, and those transfers count as rma repair transfers if you install and use rma_put_away then the rma repair transfers are the ones from the putaway moves Before this commit there is a dependency issue because the rma_repair code is using a field declared in the rma_put_away, this commit fixes that issue
- Loading branch information
1 parent
f83a0de
commit c5e3619
Showing
12 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:alt: License LGPL-3 | ||
|
||
=================== | ||
RMA Repair Put Away | ||
=================== | ||
|
||
Glue module between rma_repair & rma_put_away | ||
|
||
When not using rma_put_away you can define push rules anyway to move the products | ||
to the repair location, and those transfers count as rma repair transfers | ||
|
||
If you install and use rma_put_away then the rma repair transfers are the ones | ||
from the putaway moves | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Jordi Ballester Alomar <[email protected]> | ||
* David Jimenez <[email protected]> | ||
* Aaron Henriquez <[email protected]> | ||
|
||
|
||
Maintainer | ||
---------- | ||
|
||
This module is maintained by ForgeFlow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "RMA Repair Put Away", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"category": "RMA", | ||
"summary": "RMA repairs with Put away", | ||
"author": "ForgeFlow", | ||
"website": "https://github.com/ForgeFlow/stock-rma", | ||
"depends": ["rma_repair", "rma_put_away"], | ||
"installable": True, | ||
"auto_install": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import rma_order | ||
from . import rma_order_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 ForgeFlow S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class RmaOrder(models.Model): | ||
_inherit = "rma.order" | ||
|
||
def _compute_repair_transfer_count(self): | ||
res = super()._compute_repair_transfer_count() | ||
for order in self: | ||
pickings = ( | ||
order.mapped("rma_line_ids.move_ids") | ||
.filtered(lambda m: m.is_rma_put_away) | ||
.mapped("picking_id") | ||
) | ||
order.repair_transfer_count = len(pickings) | ||
return res | ||
|
||
def action_view_repair_transfers(self): | ||
super()._compute_repair_transfer_count() | ||
self.ensure_one() | ||
action = self.env.ref("stock.action_picking_tree_all") | ||
result = action.sudo().read()[0] | ||
pickings = self.env["stock.picking"] | ||
for line in self.rma_line_ids: | ||
pickings |= line.move_ids.filtered(lambda m: m.is_rma_put_away).mapped( | ||
"picking_id" | ||
) | ||
return self._view_shipments(result, pickings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2024 ForgeFlow S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class RmaOrderLine(models.Model): | ||
_inherit = "rma.order.line" | ||
|
||
def _compute_repair_transfer_count(self): | ||
for line in self: | ||
pickings = line.move_ids.filtered(lambda m: m.is_rma_put_away).mapped( | ||
"picking_id" | ||
) | ||
line.repair_transfer_count = len(pickings) | ||
|
||
def action_view_repair_transfers(self): | ||
super().action_view_repair_transfers() | ||
action = self.env.ref("stock.action_picking_tree_all") | ||
result = action.sudo().read()[0] | ||
pickings = self.env["stock.picking"] | ||
for line in self: | ||
pickings |= line.move_ids.filtered(lambda m: m.is_rma_put_away).mapped( | ||
"picking_id" | ||
) | ||
# choose the view_mode accordingly | ||
if len(pickings) != 1: | ||
result["domain"] = "[('id', 'in', " + str(pickings.ids) + ")]" | ||
elif len(pickings) == 1: | ||
res = self.env.ref("stock.view_picking_form", False) | ||
result["views"] = [(res and res.id or False, "form")] | ||
result["res_id"] = pickings.ids[0] | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import rma_order_line_make_repair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 ForgeFlow S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class RmaLineMakeRepair(models.TransientModel): | ||
_inherit = "rma.order.line.make.repair" | ||
|
||
def create_repair_procurement_condition_applies(self, rma_line, repair): | ||
res = super().create_repair_procurement_condition_applies(rma_line, repair) | ||
if rma_line.operation_id.put_away_location_id: | ||
return rma_line.operation_id.put_away_location_id != repair.location_id | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../rma_repair_put_away |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |