From 2684d83bf3ffba0b292d1e308ef943926394bb27 Mon Sep 17 00:00:00 2001 From: DavidJForgeFlow Date: Wed, 8 Jan 2025 12:38:16 +0100 Subject: [PATCH] [MIG] rma_filter_lot: Migration to 17.0 Moved the domain from the python declaration to xml view field to match base changes (https://github.com/ForgeFlow/stock-rma/commit/6c67346b084c7764e2904b247b6c9b3dc0598cd8). --- rma_filter_lot/__manifest__.py | 4 ++-- rma_filter_lot/models/rma_order_line.py | 13 ++++--------- rma_filter_lot/views/rma_order_view.xml | 5 +++++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rma_filter_lot/__manifest__.py b/rma_filter_lot/__manifest__.py index c12e81fa..6911eda1 100644 --- a/rma_filter_lot/__manifest__.py +++ b/rma_filter_lot/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2021 ForgeFlow S.L. +# Copyright 2021-24 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) { "name": "RMA Filter Lot", - "version": "15.0.1.0.0", + "version": "17.0.1.0.0", "license": "LGPL-3", "category": "RMA", "summary": "Filter RMA lots", diff --git a/rma_filter_lot/models/rma_order_line.py b/rma_filter_lot/models/rma_order_line.py index d3283271..b5a42ab0 100644 --- a/rma_filter_lot/models/rma_order_line.py +++ b/rma_filter_lot/models/rma_order_line.py @@ -1,4 +1,4 @@ -# Copyright 2021 ForgeFlow S.L. +# Copyright 2021-24 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo import api, fields, models @@ -8,27 +8,22 @@ from odoo.tools import float_compare class RmaOrderLine(models.Model): _inherit = "rma.order.line" - lot_id = fields.Many2one( - domain="[('id', 'in', valid_lot_ids)]", - ) valid_lot_ids = fields.One2many( - comodel_name="stock.production.lot", + comodel_name="stock.lot", compute="_compute_domain_lot_ids", ) @api.depends("product_id") def _compute_domain_lot_ids(self): for rec in self: - lots = rec.env["stock.production.lot"].search( - [("product_id", "=", rec.product_id.id)] - ) + lots = rec.env["stock.lot"].search([("product_id", "=", rec.product_id.id)]) if ( lots and rec.type == "customer" and rec.product_id and rec.product_id.tracking != "none" ): - valid_ids = self.env["stock.production.lot"] + valid_ids = self.env["stock.lot"] for quant in rec.product_id.stock_quant_ids: if ( float_compare(quant.available_quantity, 0.0, precision_digits=2) diff --git a/rma_filter_lot/views/rma_order_view.xml b/rma_filter_lot/views/rma_order_view.xml index cef3c835..15e85bde 100644 --- a/rma_filter_lot/views/rma_order_view.xml +++ b/rma_filter_lot/views/rma_order_view.xml @@ -8,6 +8,11 @@ + + [('product_id', '=', product_id),('id','in',valid_lot_ids)] +