This commit is contained in:
2026-03-18 18:27:29 +01:00
parent a41ec4412d
commit d6207855a0
2 changed files with 13 additions and 2 deletions

View File

@@ -1205,7 +1205,7 @@ class LotQt(
# OpenPosition.create_from_purchase_line(pl) # OpenPosition.create_from_purchase_line(pl)
@classmethod @classmethod
def getQuery(cls,purchase=None,sale=None,shipment=None,type=None,state=None,qttype=None,supplier=None,client=None,ps=None,lot_status=None,group=None,product=None,location=None,origin=None): def getQuery(cls,purchase=None,sale=None,shipment=None,type=None,state=None,qttype=None,supplier=None,client=None,ps=None,lot_status=None,group=None,product=None,location=None,origin=None,finished=False):
pool = Pool() pool = Pool()
LotQt = pool.get('lot.qt') LotQt = pool.get('lot.qt')
lqt = LotQt.__table__() lqt = LotQt.__table__()
@@ -1292,6 +1292,8 @@ class LotQt(
wh &= (pu.party == supplier) wh &= (pu.party == supplier)
if client and sa: if client and sa:
wh &= (sa.party == client) wh &= (sa.party == client)
if not finished:
wh &= (pl.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)) 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) MaQt = Case(((lqt.lot_p>0) & (lqt.lot_s>0), lqt.lot_quantity),else_=0)
@@ -1844,7 +1846,8 @@ class LotReport(
supplier = context.get('supplier') supplier = context.get('supplier')
#asof = context.get('asof') #asof = context.get('asof')
#todate = context.get('todate') #todate = context.get('todate')
query = LotQt.getQuery(purchase,sale,shipment,type,state,None,supplier,None,None,wh,group,product,location,origin) finished = context.get('finished')
query = LotQt.getQuery(purchase,sale,shipment,type,state,None,supplier,None,None,wh,group,product,location,origin,finished)
return query return query
@classmethod @classmethod
@@ -1934,6 +1937,12 @@ class LotContext(ModelView):
('pnl', 'Pnl'), ('pnl', 'Pnl'),
],'Mode') ],'Mode')
finished = fields.Boolean("Display finished")
@classmethod
def default_finished(cls):
return False
@classmethod @classmethod
def default_asof(cls): def default_asof(cls):
pool = Pool() pool = Pool()

View File

@@ -27,4 +27,6 @@
<field name="group"/> <field name="group"/>
<label name="origin"/> <label name="origin"/>
<field name="origin"/> <field name="origin"/>
<label name="finished"/>
<field name="finished"/>
</form> </form>