chore: rename FifoValuation to FIFOValuation
This commit is contained in:
parent
745caf911a
commit
107b404105
@ -16,7 +16,7 @@ from erpnext.stock.utils import (
|
|||||||
get_or_make_bin,
|
get_or_make_bin,
|
||||||
get_valuation_method,
|
get_valuation_method,
|
||||||
)
|
)
|
||||||
from erpnext.stock.valuation import FifoValuation
|
from erpnext.stock.valuation import FIFOValuation
|
||||||
|
|
||||||
|
|
||||||
class NegativeStockError(frappe.ValidationError): pass
|
class NegativeStockError(frappe.ValidationError): pass
|
||||||
@ -701,7 +701,7 @@ class update_entries_after(object):
|
|||||||
actual_qty = flt(sle.actual_qty)
|
actual_qty = flt(sle.actual_qty)
|
||||||
outgoing_rate = flt(sle.outgoing_rate)
|
outgoing_rate = flt(sle.outgoing_rate)
|
||||||
|
|
||||||
fifo_queue = FifoValuation(self.wh_data.stock_queue)
|
fifo_queue = FIFOValuation(self.wh_data.stock_queue)
|
||||||
if actual_qty > 0:
|
if actual_qty > 0:
|
||||||
fifo_queue.add_stock(qty=actual_qty, rate=incoming_rate)
|
fifo_queue.add_stock(qty=actual_qty, rate=incoming_rate)
|
||||||
else:
|
else:
|
||||||
|
@ -3,7 +3,7 @@ import unittest
|
|||||||
from hypothesis import given
|
from hypothesis import given
|
||||||
from hypothesis import strategies as st
|
from hypothesis import strategies as st
|
||||||
|
|
||||||
from erpnext.stock.valuation import FifoValuation, _round_off_if_near_zero
|
from erpnext.stock.valuation import FIFOValuation, _round_off_if_near_zero
|
||||||
|
|
||||||
qty_gen = st.floats(min_value=-1e6, max_value=1e6)
|
qty_gen = st.floats(min_value=-1e6, max_value=1e6)
|
||||||
value_gen = st.floats(min_value=1, max_value=1e6)
|
value_gen = st.floats(min_value=1, max_value=1e6)
|
||||||
@ -13,7 +13,7 @@ stock_queue_generator = st.lists(st.tuples(qty_gen, value_gen), min_size=10)
|
|||||||
class TestFifoValuation(unittest.TestCase):
|
class TestFifoValuation(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.queue = FifoValuation([])
|
self.queue = FIFOValuation([])
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
qty, value = self.queue.get_total_stock_and_value()
|
qty, value = self.queue.get_total_stock_and_value()
|
||||||
@ -41,12 +41,12 @@ class TestFifoValuation(unittest.TestCase):
|
|||||||
self.assertEqual(self.queue, [[2, 10]])
|
self.assertEqual(self.queue, [[2, 10]])
|
||||||
|
|
||||||
def test_adding_negative_stock_keeps_rate(self):
|
def test_adding_negative_stock_keeps_rate(self):
|
||||||
self.queue = FifoValuation([[-5.0, 100]])
|
self.queue = FIFOValuation([[-5.0, 100]])
|
||||||
self.queue.add_stock(1, 10)
|
self.queue.add_stock(1, 10)
|
||||||
self.assertEqual(self.queue, [[-4, 100]])
|
self.assertEqual(self.queue, [[-4, 100]])
|
||||||
|
|
||||||
def test_adding_negative_stock_updates_rate(self):
|
def test_adding_negative_stock_updates_rate(self):
|
||||||
self.queue = FifoValuation([[-5.0, 100]])
|
self.queue = FIFOValuation([[-5.0, 100]])
|
||||||
self.queue.add_stock(6, 10)
|
self.queue.add_stock(6, 10)
|
||||||
self.assertEqual(self.queue, [[1, 10]])
|
self.assertEqual(self.queue, [[1, 10]])
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class TestFifoValuation(unittest.TestCase):
|
|||||||
|
|
||||||
@given(stock_queue_generator)
|
@given(stock_queue_generator)
|
||||||
def test_fifo_qty_hypothesis(self, stock_queue):
|
def test_fifo_qty_hypothesis(self, stock_queue):
|
||||||
self.queue = FifoValuation([])
|
self.queue = FIFOValuation([])
|
||||||
total_qty = 0
|
total_qty = 0
|
||||||
|
|
||||||
for qty, rate in stock_queue:
|
for qty, rate in stock_queue:
|
||||||
@ -144,7 +144,7 @@ class TestFifoValuation(unittest.TestCase):
|
|||||||
|
|
||||||
@given(stock_queue_generator)
|
@given(stock_queue_generator)
|
||||||
def test_fifo_qty_value_nonneg_hypothesis(self, stock_queue):
|
def test_fifo_qty_value_nonneg_hypothesis(self, stock_queue):
|
||||||
self.queue = FifoValuation([])
|
self.queue = FIFOValuation([])
|
||||||
total_qty = 0.0
|
total_qty = 0.0
|
||||||
total_value = 0.0
|
total_value = 0.0
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ QTY = 0
|
|||||||
RATE = 1
|
RATE = 1
|
||||||
|
|
||||||
|
|
||||||
class FifoValuation:
|
class FIFOValuation:
|
||||||
"""Valuation method where a queue of all the incoming stock is maintained.
|
"""Valuation method where a queue of all the incoming stock is maintained.
|
||||||
|
|
||||||
New stock is added at end of the queue.
|
New stock is added at end of the queue.
|
||||||
|
Loading…
Reference in New Issue
Block a user