diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index e5e53f25110..6ca804e7bc4 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -17,7 +17,8 @@
from __future__ import unicode_literals
import webnotes
-from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, sendmail
+from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate
+from webnotes.utils.email_lib import sendmail
from webnotes.utils import comma_and
from webnotes.model.doc import make_autoname
from webnotes.model.bean import getlist
diff --git a/selling/Print Format/Quotation Classic/Quotation Classic.txt b/selling/Print Format/Quotation Classic/Quotation Classic.txt
index ca950a21ad6..e6ea84d2ff5 100644
--- a/selling/Print Format/Quotation Classic/Quotation Classic.txt
+++ b/selling/Print Format/Quotation Classic/Quotation Classic.txt
@@ -1,15 +1,15 @@
[
{
- "creation": "2012-04-17 11:29:12",
+ "creation": "2013-02-19 16:00:58",
"docstatus": 0,
- "modified": "2013-02-19 15:44:56",
+ "modified": "2013-03-05 11:57:20",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doc_type": "Quotation",
"doctype": "Print Format",
- "html": "\n\n\n\n\n\n\n\n\n\n\n
\n\n\t\n\t\n
\n\n",
+ "html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n",
"module": "Selling",
"name": "__common__",
"standard": "Yes"
diff --git a/selling/Print Format/Quotation Modern/Quotation Modern.txt b/selling/Print Format/Quotation Modern/Quotation Modern.txt
index a323fbf8292..1919b93add1 100644
--- a/selling/Print Format/Quotation Modern/Quotation Modern.txt
+++ b/selling/Print Format/Quotation Modern/Quotation Modern.txt
@@ -1,15 +1,15 @@
[
{
- "creation": "2012-04-17 11:29:12",
+ "creation": "2013-02-19 16:23:17",
"docstatus": 0,
- "modified": "2013-02-19 15:44:22",
+ "modified": "2013-03-05 11:57:53",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doc_type": "Quotation",
"doctype": "Print Format",
- "html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n",
+ "html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n",
"module": "Selling",
"name": "__common__",
"standard": "Yes"
diff --git a/selling/Print Format/Quotation Spartan/Quotation Spartan.txt b/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
index d2e04dda8d6..461bc0b7b11 100644
--- a/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
+++ b/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
@@ -1,15 +1,15 @@
[
{
- "creation": "2012-04-17 11:29:12",
+ "creation": "2013-02-19 16:23:17",
"docstatus": 0,
- "modified": "2013-02-19 15:45:22",
+ "modified": "2013-03-05 11:56:50",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doc_type": "Quotation",
"doctype": "Print Format",
- "html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n",
+ "html": "\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n",
"module": "Selling",
"name": "__common__",
"standard": "Yes"
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index ae408585645..44f82d2cf11 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -16,6 +16,43 @@ class TestMaterialRequest(unittest.TestCase):
"warehouse": "_Test Warehouse"}, "indented_qty")), qty1)
self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200",
"warehouse": "_Test Warehouse"}, "indented_qty")), qty2)
+
+ def _insert_stock_entry(self, qty1, qty2):
+ se = webnotes.bean([
+ {
+ "company": "_Test Company",
+ "doctype": "Stock Entry",
+ "posting_date": "2013-03-01",
+ "posting_time": "00:00:00",
+ "purpose": "Material Receipt"
+ },
+ {
+ "conversion_factor": 1.0,
+ "doctype": "Stock Entry Detail",
+ "item_code": "_Test Item Home Desktop 100",
+ "parentfield": "mtn_details",
+ "incoming_rate": 100,
+ "qty": qty1,
+ "stock_uom": "_Test UOM",
+ "transfer_qty": qty1,
+ "uom": "_Test UOM",
+ "t_warehouse": "_Test Warehouse 1",
+ },
+ {
+ "conversion_factor": 1.0,
+ "doctype": "Stock Entry Detail",
+ "item_code": "_Test Item Home Desktop 200",
+ "parentfield": "mtn_details",
+ "incoming_rate": 100,
+ "qty": qty2,
+ "stock_uom": "_Test UOM",
+ "transfer_qty": qty2,
+ "uom": "_Test UOM",
+ "t_warehouse": "_Test Warehouse 1",
+ },
+ ])
+ se.insert()
+ se.submit()
def test_completed_qty_for_purchase(self):
webnotes.conn.sql("""delete from `tabBin`""")
@@ -70,6 +107,7 @@ class TestMaterialRequest(unittest.TestCase):
def test_completed_qty_for_transfer(self):
webnotes.conn.sql("""delete from `tabBin`""")
+ webnotes.conn.sql("""delete from `tabStock Ledger Entry`""")
# submit material request of type Purchase
mr = webnotes.bean(copy=test_records[0])
@@ -87,7 +125,7 @@ class TestMaterialRequest(unittest.TestCase):
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
se_doclist[0].fields.update({
"posting_date": "2013-03-01",
- "posting_time": "00:00"
+ "posting_time": "01:00"
})
se_doclist[1].fields.update({
"qty": 27.0,
@@ -102,6 +140,9 @@ class TestMaterialRequest(unittest.TestCase):
"incoming_rate": 1.0
})
+ # make available the qty in _Test Warehouse 1 before transfer
+ self._insert_stock_entry(27.0, 1.5)
+
# check for stopped status of Material Request
se = webnotes.bean(copy=se_doclist)
se.insert()
@@ -127,6 +168,7 @@ class TestMaterialRequest(unittest.TestCase):
def test_completed_qty_for_over_transfer(self):
webnotes.conn.sql("""delete from `tabBin`""")
+ webnotes.conn.sql("""delete from `tabStock Ledger Entry`""")
# submit material request of type Purchase
mr = webnotes.bean(copy=test_records[0])
@@ -158,6 +200,9 @@ class TestMaterialRequest(unittest.TestCase):
"s_warehouse": "_Test Warehouse 1",
"incoming_rate": 1.0
})
+
+ # make available the qty in _Test Warehouse 1 before transfer
+ self._insert_stock_entry(60.0, 3.0)
# check for stopped status of Material Request
se = webnotes.bean(copy=se_doclist)
@@ -245,5 +290,5 @@ test_records = [
"uom": "_Test UOM",
"warehouse": "_Test Warehouse"
}
- ]
+ ],
]
\ No newline at end of file
diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py
index 05d74607738..278c283284a 100644
--- a/stock/doctype/stock_entry/stock_entry.py
+++ b/stock/doctype/stock_entry/stock_entry.py
@@ -207,9 +207,8 @@ class DocType(TransactionBase):
def validate_incoming_rate(self):
for d in getlist(self.doclist, 'mtn_details'):
- if not flt(d.incoming_rate) and d.t_warehouse:
- msgprint("Rate is mandatory for Item: %s at row %s" % (d.item_code, d.idx),
- raise_exception=1)
+ if d.t_warehouse:
+ self.validate_value("incoming_rate", ">", 0, d)
def validate_bom(self):
for d in getlist(self.doclist, 'mtn_details'):