diff --git a/sale_stock_operating_unit/models/stock_warehouse.py b/sale_stock_operating_unit/models/stock_warehouse.py index c4eabcc795..3fe320e312 100644 --- a/sale_stock_operating_unit/models/stock_warehouse.py +++ b/sale_stock_operating_unit/models/stock_warehouse.py @@ -14,9 +14,9 @@ class StockWarehouse(models.Model): @api.constrains('operating_unit_id') def _check_existing_so_in_wh(self): for rec in self: - sales = self.env['sales.order'].search([ + sales = self.env['sale.order'].search([ ('warehouse_id', '=', rec.id), - ('operating_unit_id', '!=', rec.operating_unit_id)]) + ('operating_unit_id', '!=', rec.operating_unit_id.id)]) if sales: raise ValidationError(_( 'Sales Order records already exist(s) for this warehouse'