Fixed an issue where it was not possible to delete farm animals

This commit is contained in:
Sergi Carol 2017-03-17 11:17:52 +01:00
parent 55628a29b0
commit 895157dd6a
1 changed files with 3 additions and 3 deletions

View File

@ -481,9 +481,9 @@ class Animal(ModelSQL, ModelView, AnimalMixin):
pool = Pool()
Lot = pool.get('stock.lot')
lots = [a.lot for a in animals]
if lots:
Lot.write(lots, {'animal': None})
lots = [a.lot for a in animals if a.lot is not None]
# if lots:
# Lot.write(lots, {'animal': None})
result = super(Animal, cls).delete(animals)
if lots:
Lot.delete(lots)