Fixes after change in fields handling in Document
This commit is contained in:
parent
76f330ca66
commit
4b2692182a
@ -196,7 +196,9 @@ class DocType(SellingController):
|
|||||||
# set pos values in items
|
# set pos values in items
|
||||||
for item in self.doclist.get({"parentfield": "entries"}):
|
for item in self.doclist.get({"parentfield": "entries"}):
|
||||||
if item.fields.get('item_code'):
|
if item.fields.get('item_code'):
|
||||||
for fname, val in get_pos_settings_item_details(pos, item.fields, pos).items():
|
for fname, val in get_pos_settings_item_details(pos,
|
||||||
|
frappe._dict(item.fields), pos).items():
|
||||||
|
|
||||||
if (not for_validate) or (for_validate and not item.fields.get(fname)):
|
if (not for_validate) or (for_validate and not item.fields.get(fname)):
|
||||||
item.fields[fname] = val
|
item.fields[fname] = val
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
|||||||
self.assertEquals(pr[0]["doctype"], "Purchase Receipt")
|
self.assertEquals(pr[0]["doctype"], "Purchase Receipt")
|
||||||
self.assertEquals(len(pr), len(test_records[0]))
|
self.assertEquals(len(pr), len(test_records[0]))
|
||||||
|
|
||||||
pr[0].naming_series = "_T-Purchase Receipt-"
|
pr[0]["naming_series"] = "_T-Purchase Receipt-"
|
||||||
pr_bean = frappe.bean(pr)
|
pr_bean = frappe.bean(pr)
|
||||||
pr_bean.insert()
|
pr_bean.insert()
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ class TestPurchaseOrder(unittest.TestCase):
|
|||||||
self.assertEquals(pr[0]["doctype"], "Purchase Receipt")
|
self.assertEquals(pr[0]["doctype"], "Purchase Receipt")
|
||||||
self.assertEquals(len(pr), len(test_records[0]))
|
self.assertEquals(len(pr), len(test_records[0]))
|
||||||
pr[0]["posting_date"] = "2013-05-12"
|
pr[0]["posting_date"] = "2013-05-12"
|
||||||
pr[0].naming_series = "_T-Purchase Receipt-"
|
pr[0]["naming_series"] = "_T-Purchase Receipt-"
|
||||||
pr[1].qty = 4.0
|
pr[1]["qty"] = 4.0
|
||||||
pr_bean = frappe.bean(pr)
|
pr_bean = frappe.bean(pr)
|
||||||
pr_bean.insert()
|
pr_bean.insert()
|
||||||
pr_bean.submit()
|
pr_bean.submit()
|
||||||
@ -64,9 +64,9 @@ class TestPurchaseOrder(unittest.TestCase):
|
|||||||
frappe.db.set_value('Item', '_Test Item', 'tolerance', 50)
|
frappe.db.set_value('Item', '_Test Item', 'tolerance', 50)
|
||||||
|
|
||||||
pr1 = make_purchase_receipt(po.doc.name)
|
pr1 = make_purchase_receipt(po.doc.name)
|
||||||
pr1[0].naming_series = "_T-Purchase Receipt-"
|
pr1[0]["naming_series"] = "_T-Purchase Receipt-"
|
||||||
pr1[0]["posting_date"] = "2013-05-12"
|
pr1[0]["posting_date"] = "2013-05-12"
|
||||||
pr1[1].qty = 8
|
pr1[1]["qty"] = 8
|
||||||
pr1_bean = frappe.bean(pr1)
|
pr1_bean = frappe.bean(pr1)
|
||||||
pr1_bean.insert()
|
pr1_bean.insert()
|
||||||
pr1_bean.submit()
|
pr1_bean.submit()
|
||||||
@ -89,7 +89,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
|||||||
self.assertEquals(pi[0]["doctype"], "Purchase Invoice")
|
self.assertEquals(pi[0]["doctype"], "Purchase Invoice")
|
||||||
self.assertEquals(len(pi), len(test_records[0]))
|
self.assertEquals(len(pi), len(test_records[0]))
|
||||||
pi[0]["posting_date"] = "2013-05-12"
|
pi[0]["posting_date"] = "2013-05-12"
|
||||||
pi[0].bill_no = "NA"
|
pi[0]["bill_no"] = "NA"
|
||||||
frappe.bean(pi).insert()
|
frappe.bean(pi).insert()
|
||||||
|
|
||||||
def test_subcontracting(self):
|
def test_subcontracting(self):
|
||||||
|
@ -89,7 +89,8 @@ class AccountsController(TransactionBase):
|
|||||||
from erpnext.stock.get_item_details import get_item_details
|
from erpnext.stock.get_item_details import get_item_details
|
||||||
for item in self.doclist.get({"parentfield": self.fname}):
|
for item in self.doclist.get({"parentfield": self.fname}):
|
||||||
if item.fields.get("item_code"):
|
if item.fields.get("item_code"):
|
||||||
args = item.fields.copy().update(self.doc.fields)
|
args = item.fields.copy()
|
||||||
|
args.update(self.doc.fields)
|
||||||
ret = get_item_details(args)
|
ret = get_item_details(args)
|
||||||
for fieldname, value in ret.items():
|
for fieldname, value in ret.items():
|
||||||
if self.meta.get_field(fieldname, parentfield=self.fname) and \
|
if self.meta.get_field(fieldname, parentfield=self.fname) and \
|
||||||
|
@ -25,6 +25,6 @@ class TestLead(unittest.TestCase):
|
|||||||
self.assertEquals(customer[0]["doctype"], "Customer")
|
self.assertEquals(customer[0]["doctype"], "Customer")
|
||||||
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
|
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
|
||||||
|
|
||||||
customer[0].customer_group = "_Test Customer Group"
|
customer[0]["customer_group"] = "_Test Customer Group"
|
||||||
frappe.bean(customer).insert()
|
frappe.bean(customer).insert()
|
||||||
|
|
@ -37,7 +37,7 @@ class TestDeliveryNote(unittest.TestCase):
|
|||||||
self.assertEquals(len(si), len(dn.doclist))
|
self.assertEquals(len(si), len(dn.doclist))
|
||||||
|
|
||||||
# modify amount
|
# modify amount
|
||||||
si[1].rate = 200
|
si[1]["rate"] = 200
|
||||||
self.assertRaises(frappe.ValidationError, frappe.bean(si).insert)
|
self.assertRaises(frappe.ValidationError, frappe.bean(si).insert)
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,12 +124,12 @@ class TestMaterialRequest(unittest.TestCase):
|
|||||||
# map a purchase order
|
# map a purchase order
|
||||||
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
|
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
|
||||||
po_doclist = make_purchase_order(mr.doc.name)
|
po_doclist = make_purchase_order(mr.doc.name)
|
||||||
po_doclist[0].supplier = "_Test Supplier"
|
po_doclist[0]["supplier"] = "_Test Supplier"
|
||||||
po_doclist[0].transaction_date = "2013-07-07"
|
po_doclist[0]["transaction_date"] = "2013-07-07"
|
||||||
po_doclist[1].qty = 27.0
|
po_doclist[1]["qty"] = 27.0
|
||||||
po_doclist[2].qty = 1.5
|
po_doclist[2]["qty"] = 1.5
|
||||||
po_doclist[1].schedule_date = "2013-07-09"
|
po_doclist[1]["schedule_date"] = "2013-07-09"
|
||||||
po_doclist[2].schedule_date = "2013-07-09"
|
po_doclist[2]["schedule_date"] = "2013-07-09"
|
||||||
|
|
||||||
|
|
||||||
# check for stopped status of Material Request
|
# check for stopped status of Material Request
|
||||||
|
@ -27,7 +27,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
|||||||
self.assertEquals(len(pi), len(pr.doclist))
|
self.assertEquals(len(pi), len(pr.doclist))
|
||||||
|
|
||||||
# modify rate
|
# modify rate
|
||||||
pi[1].rate = 200
|
pi[1]["rate"] = 200
|
||||||
self.assertRaises(frappe.ValidationError, frappe.bean(pi).submit)
|
self.assertRaises(frappe.ValidationError, frappe.bean(pi).submit)
|
||||||
|
|
||||||
def test_purchase_receipt_no_gl_entry(self):
|
def test_purchase_receipt_no_gl_entry(self):
|
||||||
|
@ -32,6 +32,7 @@ def get_item_details(args):
|
|||||||
|
|
||||||
if isinstance(args, basestring):
|
if isinstance(args, basestring):
|
||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
|
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|
||||||
if not args.get("transaction_type"):
|
if not args.get("transaction_type"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user