From 06eaebd0982f2b833faefdcd5caebee6068f3957 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Fri, 25 Oct 2024 14:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=B1=BB=E5=88=AB=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quality_control/models/product_category.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quality_control/models/product_category.py b/quality_control/models/product_category.py index 9b5535d4..17f26006 100644 --- a/quality_control/models/product_category.py +++ b/quality_control/models/product_category.py @@ -21,4 +21,12 @@ class ProductCategory(models.Model): args += [('name', 'not in', ['Saleable', 'Expenses', 'Deliveries'])] # 调用父类的 name_search 方法 - return super(ProductCategory, self).name_search(name, args=args, operator=operator, limit=limit) \ No newline at end of file + return super(ProductCategory, self).name_search(name, args=args, operator=operator, limit=limit) + + @api.model + def search(self, args, limit=100, offset=0, order=None, count=False): + # 添加过滤条件,确保只返回名称不在指定列表中的记录 + args += [('name', 'not in', ['Saleable', 'Expenses', 'Deliveries'])] + + # 调用父类的 search 方法 + return super(ProductCategory, self).search(args, limit=limit, offset=offset, order=order, count=count) \ No newline at end of file