diff --git a/modules/purchase_trade/ctrm_reporting.py b/modules/purchase_trade/ctrm_reporting.py index 64dda5b..973f4da 100644 --- a/modules/purchase_trade/ctrm_reporting.py +++ b/modules/purchase_trade/ctrm_reporting.py @@ -419,7 +419,7 @@ class CTRMLongShortMixin: def _physical_quantity_query(cls, lot, line_field): return lot.select( getattr(lot, line_field).as_('line'), - Sum(Coalesce(lot.lot_quantity, 0)).as_('quantity'), + Sum(Coalesce(lot.lot_qt, 0)).as_('quantity'), where=((lot.lot_type == 'physic') & (getattr(lot, line_field) != Null)), group_by=[getattr(lot, line_field)])