Skip to content

Commit

Permalink
Fix constraint on warehouses (OCA#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
guewen authored and alan196 committed Jan 25, 2023
1 parent 39ee80b commit fd964af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sale_stock_operating_unit/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit fd964af

Please sign in to comment.