fix: '>=' not supported between instances of 'str' and 'int'

This commit is contained in:
marination 2020-06-03 17:13:58 +05:30
parent 881999d3bf
commit 6f7e9d2904

View File

@ -230,12 +230,12 @@ def get_valuation_method(item_code):
def get_fifo_rate(previous_stock_queue, qty): def get_fifo_rate(previous_stock_queue, qty):
"""get FIFO (average) Rate from Queue""" """get FIFO (average) Rate from Queue"""
if qty >= 0: if flt(qty) >= 0:
total = sum(f[0] for f in previous_stock_queue) total = sum(f[0] for f in previous_stock_queue)
return sum(flt(f[0]) * flt(f[1]) for f in previous_stock_queue) / flt(total) if total else 0.0 return sum(flt(f[0]) * flt(f[1]) for f in previous_stock_queue) / flt(total) if total else 0.0
else: else:
available_qty_for_outgoing, outgoing_cost = 0, 0 available_qty_for_outgoing, outgoing_cost = 0, 0
qty_to_pop = abs(qty) qty_to_pop = abs(flt(qty))
while qty_to_pop and previous_stock_queue: while qty_to_pop and previous_stock_queue:
batch = previous_stock_queue[0] batch = previous_stock_queue[0]
if 0 < batch[0] <= qty_to_pop: if 0 < batch[0] <= qty_to_pop: