Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Anand Doshi 2013-03-12 12:48:10 +05:30
commit 4127bb14ed
4 changed files with 24 additions and 17 deletions

View File

@ -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",
}
],

View File

@ -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

View File

@ -43,19 +43,24 @@
</div></p>
<script>
$("#footer-subscribe-button").click(function() {
$("#footer-subscribe-email").attr('disabled', true);
$("#footer-subscribe-button").html("Sending...")
.attr("disabled", true);
if($("#footer-subscribe-email").val()) {
erpnext.send_message({
subject:"Subscribe me",
sender: $("#footer-subscribe-email").val(),
message: "Subscribe to newsletter (via website footer).",
callback: function(r) {
console.log(r)
if(!r.exc) {
$("#footer-subscribe-email").val("").attr('disabled', true);
$("#footer-subscribe-button").html("Thank You :)")
.addClass("btn-success").attr("disabled", true);
} else {
$("#footer-subscribe-button").html("Error :( Not a valid id?").addClass("btn-danger");
$("#footer-subscribe-button").html("Error :( Not a valid id?")
.addClass("btn-danger").attr("disabled", false);
$("#footer-subscribe-email").val("").attr('disabled', false);
}
}
});

View File

@ -39,7 +39,7 @@
<hr>
{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
<h3>Specifications</h3>
<table class="table table-striped table-bordered" style="width: 100%">
<table class="table table-bordered" style="width: 100%">
{% for d in obj.doclist.get(
{"doctype":"Item Website Specification"}) %}
<tr>