Files
odoo_source/addons/mrp_subcontracting/models/stock_quant.py
T
Florent de Labarre 38ff430f20 [FIX] mrp_subcontracting: sql crach
In large database, if you try to get all subcontrat quant you can crach postgres with a big query.

closes odoo/odoo#106543

X-original-commit: aa104980d483efef087198dc5bb70ec63a47ed7e
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-11-25 17:56:57 +01:00

18 lines
582 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, _
from odoo.exceptions import UserError
class StockQuant(models.Model):
_inherit = 'stock.quant'
is_subcontract = fields.Boolean(store=False, search='_search_is_subcontract')
def _search_is_subcontract(self, operator, value):
if operator not in ['=', '!='] or not isinstance(value, bool):
raise UserError(_('Operation not supported'))
return [('location_id.is_subcontracting_location', operator, value)]