From 8a2c25e29efcef11457739fed10e122dd9ef2468 Mon Sep 17 00:00:00 2001 From: mav-adhoc Date: Tue, 3 Mar 2026 10:24:58 -0300 Subject: [PATCH] [FIX]product_catalog_tree: take into account catalog from account.move --- product_catalog_tree/models/product_product.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/product_catalog_tree/models/product_product.py b/product_catalog_tree/models/product_product.py index a47c6aa59..5589ee32e 100644 --- a/product_catalog_tree/models/product_product.py +++ b/product_catalog_tree/models/product_product.py @@ -82,8 +82,12 @@ def _inverse_catalog_values(self, product_catalog_qty): return order = self.env[res_model].browse(order_id) + for rec in self: - existing_lines = order.order_line.filtered(lambda line: line.product_id.id == rec.id) + if res_model == "account.move": + existing_lines = order.invoice_line_ids.filtered(lambda line: line.product_id.id == rec.id) + else: + existing_lines = order.order_line.filtered(lambda line: line.product_id.id == rec.id) if len(existing_lines) > 1 and product_catalog_qty > 0: total_current_qty = sum(existing_lines.mapped("product_uom_qty")) qty_difference = product_catalog_qty - total_current_qty