From 09d260b3546d3657d9ec31c0371194782de055c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Br=C3=BCck?= Date: Thu, 4 Jul 2024 19:31:25 +1000 Subject: [PATCH] Fix compute_ packaging --- nfu_sale_product_min_max_qty/wizard/sale_max_qty_line.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nfu_sale_product_min_max_qty/wizard/sale_max_qty_line.py b/nfu_sale_product_min_max_qty/wizard/sale_max_qty_line.py index b660e37..4f2d9fc 100644 --- a/nfu_sale_product_min_max_qty/wizard/sale_max_qty_line.py +++ b/nfu_sale_product_min_max_qty/wizard/sale_max_qty_line.py @@ -26,9 +26,6 @@ class SaleMaxQtyLine(models.TransientModel): @api.depends('packaging_size', 'qty') def _compute_quantity_fits_packaging(self): for sale_order in self: - order_lines = self.env['sale.max.qty.line'].search([ - ('product_id', '=', sale_order.product_id.id), - ('sale_max_qty_chooser', '=', sale_order.sale_max_qty_chooser.id), - ]) + order_lines = self.sale_max_qty_chooser.sale_max_qty_ids.filtered(lambda line: line.sale_line_id.product_id == sale_order.product_id) total_quantity = sum(order_lines.mapped('qty')) sale_order.quantity_fits_packaging = total_quantity % sale_order.packaging_size == 0 \ No newline at end of file