From 46de10dff655f46947601f90b9d1e63a872af76d Mon Sep 17 00:00:00 2001 From: ThiagoMForgeFlow Date: Wed, 18 Dec 2024 11:13:49 +0100 Subject: [PATCH 1/2] [IMP] product_supplierinfo_for_customer: change _name_search product restrictions Checking whether the search has a limit is restricting cases where it is important to retrieve the product by the customer's code. With this change, the restriction on res_ids_len being greater than the limit will only apply if the limit exists. --- product_supplierinfo_for_customer/models/product_product.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/product_supplierinfo_for_customer/models/product_product.py b/product_supplierinfo_for_customer/models/product_product.py index fdcdd9edf1c..2a50c6afac1 100644 --- a/product_supplierinfo_for_customer/models/product_product.py +++ b/product_supplierinfo_for_customer/models/product_product.py @@ -26,9 +26,8 @@ def _name_search(self, name, domain=None, operator="ilike", limit=None, order=No limit = (limit - res_ids_len) if limit else False if ( not name - and limit or not self._context.get("partner_id") - or res_ids_len >= limit + or (limit and res_ids_len >= limit) ): return res_ids limit -= res_ids_len From ebaa1eabc422bdb4c17bf58a7c9fa19d953a2667 Mon Sep 17 00:00:00 2001 From: JordiMForgeFlow Date: Tue, 24 Dec 2024 16:32:05 +0100 Subject: [PATCH 2/2] [FIX] product_supplierinfo_for_customer: prevent error when no limit --- product_supplierinfo_for_customer/models/product_product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/product_supplierinfo_for_customer/models/product_product.py b/product_supplierinfo_for_customer/models/product_product.py index 2a50c6afac1..2bef3fd0e77 100644 --- a/product_supplierinfo_for_customer/models/product_product.py +++ b/product_supplierinfo_for_customer/models/product_product.py @@ -30,7 +30,8 @@ def _name_search(self, name, domain=None, operator="ilike", limit=None, order=No or (limit and res_ids_len >= limit) ): return res_ids - limit -= res_ids_len + if limit: + limit -= res_ids_len customerinfo_ids = self.env["product.customerinfo"]._search( [ ("partner_id", "=", self._context.get("partner_id")),