[IMP] product: Improve search on product.template standard_price

There's no need to use a secondary search. We can directly search on the
one2many field instead.

Part-of: odoo/odoo#77088
This commit is contained in:
Ivàn Todorovich
2023-01-02 20:39:22 +01:00
parent 0730514697
commit 87bdc87d92
+1 -2
View File
@@ -226,8 +226,7 @@ class ProductTemplate(models.Model):
self._set_product_variant_field('standard_price')
def _search_standard_price(self, operator, value):
products = self.env['product.product'].search([('standard_price', operator, value)], limit=None)
return [('id', 'in', products.mapped('product_tmpl_id').ids)]
return [('product_variant_ids.standard_price', operator, value)]
@api.depends('product_variant_ids.volume')
def _compute_volume(self):