This commit is contained in:
2026-03-23 10:43:02 +01:00
parent f9ee416d99
commit e6519d30ee

View File

@@ -1253,8 +1253,12 @@ class LotQt(
#wh &= (((lqt.create_date >= asof) & ((lqt.create_date-datetime.timedelta(1)) <= todate)))
if ps == 'P':
wh &= ((lqt.lot_p != None) & (lqt.lot_s == None))
if not finished:
wh &= (pl.finished == False)
elif ps == 'S':
wh &= (((lqt.lot_s != None) & (lqt.lot_p == None)) | ((lqt.lot_s != None) & (lqt.lot_p != None) & (lp.lot_type == 'virtual')))
if not finished:
wh &= (sl.finished == False)
if purchase:
wh &= (pu.id == purchase)
if sale:
@@ -1292,9 +1296,6 @@ class LotQt(
wh &= (pu.party == supplier)
if client and sa:
wh &= (sa.party == client)
if not finished:
wh &= (pl.finished == False)
wh &= (sl.finished == False)
AvQt = Case(((lqt.lot_p>0) & (lqt.lot_s>0), 0),else_=Case((lqt.lot_p>0,lqt.lot_quantity),else_=-lqt.lot_quantity))
MaQt = Case(((lqt.lot_p>0) & (lqt.lot_s>0), lqt.lot_quantity),else_=0)