Skip to content

Commit

Permalink
[FIX] there was search on all records instead of current one
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Yelizariev committed Mar 4, 2018
1 parent 0b38659 commit 0ce9d6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion booking_calendar/models.py
Expand Up @@ -666,6 +666,6 @@ class SaleOrder(models.Model):
@api.multi
@api.constrains('state')
def _check_state(self):
if self.search_count([('state', 'not in', ['draft'])]) and \
if self.state not in ['draft'] and \
self.env['sale.order.line'].search_count([('order_id', '=', self.id), ('overlap', '=', 'True')]):
raise ValidationError(_('There are lines with overlap in this order. Please move overlapping lines to another time or resource'))

0 comments on commit 0ce9d6d

Please sign in to comment.