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