stock_quant.py 582 B

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