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

This commit is contained in:
Nabin Hait
2013-05-02 11:39:43 +05:30
9 changed files with 37 additions and 11 deletions

View File

@@ -55,7 +55,7 @@ class DocType(DocListController):
ch.conversion_factor = 1
def check_stock_uom_with_bin(self):
if not self.doc.__islocal:
if not self.doc.fields.get("__islocal"):
bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
self.doc.name)
if self.doc.stock_uom and bin and cstr(bin[0][0]) \

View File

@@ -263,6 +263,12 @@ class TestMaterialRequest(unittest.TestCase):
se = webnotes.bean(copy=se_doclist)
self.assertRaises(webnotes.MappingMismatchError, se.insert)
def test_warehouse_company_validation(self):
from controllers.buying_controller import WrongWarehouseCompany
mr = webnotes.bean(copy=test_records[0])
mr.doc.company = "_Test Company 1"
self.assertRaises(WrongWarehouseCompany, mr.insert)
test_records = [
[
{

View File

@@ -2,7 +2,8 @@ test_records = [
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse",
"warehouse_type": "_Test Warehouse Type"
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company"
}],
[{
"doctype": "Warehouse",