diff --git a/rma/models/__init__.py b/rma/models/__init__.py index 612e4aaa7..a57381a19 100644 --- a/rma/models/__init__.py +++ b/rma/models/__init__.py @@ -2,6 +2,7 @@ from . import rma_order_line from . import rma_operation from . import stock_move +from . import stock_quant_package from . import stock_warehouse from . import product from . import product_category diff --git a/rma/models/stock_quant_package.py b/rma/models/stock_quant_package.py new file mode 100644 index 000000000..4da62942e --- /dev/null +++ b/rma/models/stock_quant_package.py @@ -0,0 +1,14 @@ +# Copyright (C) 2023 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import models + + +class QuantPackage(models.Model): + _inherit = "stock.quant.package" + + def _allowed_to_move_between_transfers(self): + res = super(QuantPackage, self)._allowed_to_move_between_transfers() + return res and self.location_id != self.env.ref( + "stock.stock_location_customers" + ) diff --git a/rma/wizards/rma_make_picking.py b/rma/wizards/rma_make_picking.py index 6f036b111..69e6c2c5a 100644 --- a/rma/wizards/rma_make_picking.py +++ b/rma/wizards/rma_make_picking.py @@ -212,7 +212,7 @@ def action_create_picking(self): action = self.item_ids.line_id.action_view_in_shipments() # Force the reservation of the RMA specific lot for incoming shipments. # FIXME: still needs fixing, not reserving appropriate serials. - for move in pickings.move_lines.filtered( + for move in pickings.move_ids.filtered( lambda x: x.state not in ("draft", "cancel", "done", "waiting") and x.rma_line_id and x.product_id.tracking in ("lot", "serial")