diff --git a/modules/purchase_trade/lot.py b/modules/purchase_trade/lot.py index e2aa4c3..964786a 100755 --- a/modules/purchase_trade/lot.py +++ b/modules/purchase_trade/lot.py @@ -1323,14 +1323,14 @@ class LotQt( #wh &= (((lqt.create_date >= asof) & ((lqt.create_date-datetime.timedelta(1)) <= todate))) if ps == 'P': wh &= (lqt.lot_p != None) - if not finished: - wh &= (pl.finished == False) elif ps == 'S': wh &= (lqt.lot_s != None) - if not finished: - wh &= (sl.finished == False) - if purchase: - wh &= (pu.id == purchase) + if not finished: + wh &= ( + ((lqt.lot_p == None) | (pl.finished == False)) + & ((lqt.lot_s == None) | (sl.finished == False))) + if purchase: + wh &= (pu.id == purchase) if sale: wh &= (sa.id == sale) if state != 'all':