From 8324523f68ee0dac416e7e9f592b8b093911b12e Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 8 Feb 2017 12:09:54 +0100 Subject: [PATCH] Fix constraint on warehouses (#61) --- sale_stock_operating_unit/models/stock_warehouse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'