Faircot cron

This commit is contained in:
2026-07-20 09:30:31 +02:00
parent d6fa273d11
commit a70c2c4853
2 changed files with 26 additions and 7 deletions

View File

@@ -911,10 +911,9 @@ class Lot(metaclass=PoolMeta):
virtual_lots = [l for l in lots if l.lot_type == 'virtual']
total_physic = sum(l.get_current_quantity_converted() for l in physical_lots)
theorical = line.quantity_theorical if hasattr(line, 'quantity_theorical') else line.quantity
virtual_qty = round(theorical - total_physic, 5)
logger.info("RECOMPUTE_VIRTUAL_LOT:%s",virtual_qty)
if virtual_lots:
theorical = line.quantity_theorical if hasattr(line, 'quantity_theorical') else line.quantity
virtual_qty = round(theorical - total_physic, 5)
if virtual_lots:
vlot = virtual_lots[0]
lh = vlot.lot_hist[0]
lh.quantity = virtual_qty
@@ -1196,8 +1195,7 @@ class Lot(metaclass=PoolMeta):
line = SL(line_id)
qt = Decimal(0)
lots = list(line.lots or [])
logger.info("DELETE_RECALC:%s",lots)
for lot in lots:
for lot in lots:
if len(lots) > 1:
if lot.lot_type == 'physic':
qt += lot.get_current_quantity_converted()