From 0cfbc5feb5d8e381892834e403b6334e3eb7c964 Mon Sep 17 00:00:00 2001
From: Nabin Hait
Date: Tue, 12 Mar 2013 11:34:56 +0530
Subject: [PATCH 1/2] fixes in sales order test cases and set_buying_amount
---
.../doctype/sales_order/test_sales_order.py | 22 +++++++++----------
stock/utils.py | 6 +++--
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/selling/doctype/sales_order/test_sales_order.py b/selling/doctype/sales_order/test_sales_order.py
index 5d820fe769..40a10b439c 100644
--- a/selling/doctype/sales_order/test_sales_order.py
+++ b/selling/doctype/sales_order/test_sales_order.py
@@ -65,7 +65,7 @@ class TestSalesOrder(unittest.TestCase):
# submit dn
dn = self.create_dn_against_so(so)
- self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 6.0)
+ self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 5.0)
# stop so
so.load_from_db()
@@ -75,7 +75,7 @@ class TestSalesOrder(unittest.TestCase):
# unstop so
so.load_from_db()
so.obj.unstop_sales_order()
- self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 6.0)
+ self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 5.0)
# cancel dn
dn.cancel()
@@ -151,9 +151,9 @@ class TestSalesOrder(unittest.TestCase):
dn = self.create_dn_against_so(so)
self.check_reserved_qty(sbom_test_records[0][1]["item_code"],
- so.doclist[1].reserved_warehouse, 30.0)
+ so.doclist[1].reserved_warehouse, 25.0)
self.check_reserved_qty(sbom_test_records[0][2]["item_code"],
- so.doclist[1].reserved_warehouse, 12.0)
+ so.doclist[1].reserved_warehouse, 10.0)
# stop so
so.load_from_db()
@@ -168,9 +168,9 @@ class TestSalesOrder(unittest.TestCase):
so.load_from_db()
so.obj.unstop_sales_order()
self.check_reserved_qty(sbom_test_records[0][1]["item_code"],
- so.doclist[1].reserved_warehouse, 30.0)
+ so.doclist[1].reserved_warehouse, 25.0)
self.check_reserved_qty(sbom_test_records[0][2]["item_code"],
- so.doclist[1].reserved_warehouse, 12.0)
+ so.doclist[1].reserved_warehouse, 10.0)
# cancel dn
dn.cancel()
@@ -234,8 +234,8 @@ test_records = [
"price_list_name": "_Test Price List",
"territory": "_Test Territory",
"transaction_date": "2013-02-21",
- "grand_total": 500.0,
- "grand_total_export": 500.0,
+ "grand_total": 1000.0,
+ "grand_total_export": 1000.0,
},
{
"description": "CPU",
@@ -244,9 +244,9 @@ test_records = [
"item_name": "CPU",
"parentfield": "sales_order_details",
"qty": 10.0,
- "basic_rate": 50.0,
- "export_rate": 50.0,
- "amount": 500.0,
+ "basic_rate": 100.0,
+ "export_rate": 100.0,
+ "amount": 1000.0,
"reserved_warehouse": "_Test Warehouse",
}
],
diff --git a/stock/utils.py b/stock/utils.py
index bc6054f70b..20d08ea3eb 100644
--- a/stock/utils.py
+++ b/stock/utils.py
@@ -181,11 +181,13 @@ def get_buying_amount(item_code, warehouse, qty, voucher_type, voucher_no, vouch
def _get_buying_amount(voucher_type, voucher_no, item_row, item_code, warehouse, qty,
stock_ledger_entries):
for i, sle in enumerate(stock_ledger_entries):
- if sle.voucher_type == voucher_type and sle.voucher_no == voucher_no:
+ if sle.voucher_type == voucher_type and sle.voucher_no == voucher_no and \
+ len(stock_ledger_entries) > i+1:
if (sle.voucher_detail_no == item_row) or \
(sle.item_code == item_code and sle.warehouse == warehouse and \
abs(flt(sle.qty)) == qty):
- buying_amount = flt(stock_ledger_entries[i+1].stock_value) - flt(sle.stock_value)
+ buying_amount = flt(stock_ledger_entries[i+1].stock_value) - \
+ flt(sle.stock_value)
return buying_amount
From 06420833998aa711cf17af321068aedb949b0976 Mon Sep 17 00:00:00 2001
From: Rushabh Mehta
Date: Tue, 12 Mar 2013 12:29:10 +0530
Subject: [PATCH 2/2] website: style fixes
---
website/templates/html/footer.html | 11 ++++++++---
website/templates/html/product_page.html | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/website/templates/html/footer.html b/website/templates/html/footer.html
index 19aeabef65..2f1c7fee64 100644
--- a/website/templates/html/footer.html
+++ b/website/templates/html/footer.html
@@ -43,19 +43,24 @@