Minor fixes

This commit is contained in:
Nabin Hait 2014-10-14 17:15:02 +05:30
parent bf492122f8
commit 0dc18f0102
4 changed files with 12 additions and 6 deletions

View File

@ -112,6 +112,6 @@ class TestPurchaseOrder(unittest.TestCase):
test_recurring_document(self, test_records)
test_dependencies = ["BOM"]
test_dependencies = ["BOM", "Item Price"]
test_records = frappe.get_test_records('Purchase Order')

View File

@ -16,5 +16,11 @@
"item_code": "_Test Item 2",
"price_list": "_Test Price List Rest of the World",
"price_list_rate": 20
},
{
"doctype": "Item Price",
"item_code": "_Test Item Home Desktop 100",
"price_list": "_Test Price List",
"price_list_rate": 1000
}
]

View File

@ -151,6 +151,6 @@ def set_perpetual_inventory(enable=1):
accounts_settings.save()
test_dependencies = ["BOM"]
test_dependencies = ["BOM", "Item Price"]
test_records = frappe.get_test_records('Purchase Receipt')

View File

@ -275,7 +275,7 @@ def get_fifo_values(qty_after_transaction, sle, stock_queue):
incoming_rate = flt(sle.incoming_rate)
actual_qty = flt(sle.actual_qty)
intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse)
intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse, actual_qty)
if actual_qty > 0:
if stock_queue[-1][0] > 0:
@ -289,7 +289,7 @@ def get_fifo_values(qty_after_transaction, sle, stock_queue):
else:
qty_to_pop = abs(actual_qty)
while qty_to_pop:
intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse)
intialize_stock_queue(stock_queue, sle.item_code, sle.warehouse, actual_qty)
batch = stock_queue[0]
@ -318,9 +318,9 @@ def get_fifo_values(qty_after_transaction, sle, stock_queue):
return abs(valuation_rate)
def intialize_stock_queue(stock_queue, item_code, warehouse):
def intialize_stock_queue(stock_queue, item_code, warehouse, actual_qty):
if not stock_queue:
estimated_val_rate = get_valuation_rate(item_code, warehouse)
estimated_val_rate = get_valuation_rate(item_code, warehouse) if actual_qty < 0 else 0
stock_queue.append([0, estimated_val_rate])
def _raise_exceptions(args, verbose=1):