def inv_item_total_volume(row):
 try:
  inv_item = getattr(row, 'inv_inv_item')
 except AttributeError:
  inv_item = row
 try:
  quantity = inv_item.quantity
 except AttributeError:
  return 0.0
 try:
  supply_item = getattr(row, 'supply_item')
  volume = supply_item.volume
 except AttributeError:
  itable = current.s3db.inv_inv_item
  stable = current.s3db.supply_item
  query = ((itable.id == inv_item.id) & (itable.item_id == stable.id))
  supply_item = current.db(query).select(stable.volume, limitby=(0, 1)).first()
  if (not supply_item):
   return
  else:
   volume = supply_item.volume
 if (volume is None):
  return current.messages['NONE']
 else:
  return (quantity * volume)

def inv_item_total_volume ( row ) : try : inv_item = getattr ( row , 'inv_inv_item' ) except AttributeError : inv_item = row try : quantity = inv_item . quantity except AttributeError : return 0.0 try : supply_item = getattr ( row , 'supply_item' ) volume = supply_item . volume except AttributeError : itable = current . s3db . inv_inv_item stable = current . s3db . supply_item query = ( ( itable . id == inv_item . id ) & ( itable . item_id == stable . id ) ) supply_item = current . db ( query ) . select ( stable . volume , limitby = ( 0 , 1 ) ) . first ( ) if ( not supply_item ) : return else : volume = supply_item . volume if ( volume is None ) : return current . messages [ 'NONE' ] else : return ( quantity * volume )
compute the total volume of an inventory item .