diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index d0c69fcf82..769a01eb70 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -196,7 +196,9 @@ class DocType(SellingController): # set pos values in items for item in self.doclist.get({"parentfield": "entries"}): 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)): item.fields[fname] = val diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 88a323416f..d58ce17bea 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -25,7 +25,7 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(pr[0]["doctype"], "Purchase Receipt") 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.insert() @@ -52,8 +52,8 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(pr[0]["doctype"], "Purchase Receipt") self.assertEquals(len(pr), len(test_records[0])) pr[0]["posting_date"] = "2013-05-12" - pr[0].naming_series = "_T-Purchase Receipt-" - pr[1].qty = 4.0 + pr[0]["naming_series"] = "_T-Purchase Receipt-" + pr[1]["qty"] = 4.0 pr_bean = frappe.bean(pr) pr_bean.insert() pr_bean.submit() @@ -64,9 +64,9 @@ class TestPurchaseOrder(unittest.TestCase): frappe.db.set_value('Item', '_Test Item', 'tolerance', 50) 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[1].qty = 8 + pr1[1]["qty"] = 8 pr1_bean = frappe.bean(pr1) pr1_bean.insert() pr1_bean.submit() @@ -89,7 +89,7 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(pi[0]["doctype"], "Purchase Invoice") self.assertEquals(len(pi), len(test_records[0])) pi[0]["posting_date"] = "2013-05-12" - pi[0].bill_no = "NA" + pi[0]["bill_no"] = "NA" frappe.bean(pi).insert() def test_subcontracting(self): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 9e75135ab0..7ad5d86c62 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -89,7 +89,8 @@ class AccountsController(TransactionBase): from erpnext.stock.get_item_details import get_item_details for item in self.doclist.get({"parentfield": self.fname}): 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) for fieldname, value in ret.items(): if self.meta.get_field(fieldname, parentfield=self.fname) and \ diff --git a/erpnext/selling/doctype/lead/test_lead.py b/erpnext/selling/doctype/lead/test_lead.py index 3589939121..f4b321e712 100644 --- a/erpnext/selling/doctype/lead/test_lead.py +++ b/erpnext/selling/doctype/lead/test_lead.py @@ -25,6 +25,6 @@ class TestLead(unittest.TestCase): self.assertEquals(customer[0]["doctype"], "Customer") 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() \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 16b8d3b5b8..1ad65070a8 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -37,7 +37,7 @@ class TestDeliveryNote(unittest.TestCase): self.assertEquals(len(si), len(dn.doclist)) # modify amount - si[1].rate = 200 + si[1]["rate"] = 200 self.assertRaises(frappe.ValidationError, frappe.bean(si).insert) diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index 0f06b505ab..a41425bf85 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -124,12 +124,12 @@ class TestMaterialRequest(unittest.TestCase): # map a purchase order from erpnext.stock.doctype.material_request.material_request import make_purchase_order po_doclist = make_purchase_order(mr.doc.name) - po_doclist[0].supplier = "_Test Supplier" - po_doclist[0].transaction_date = "2013-07-07" - po_doclist[1].qty = 27.0 - po_doclist[2].qty = 1.5 - po_doclist[1].schedule_date = "2013-07-09" - po_doclist[2].schedule_date = "2013-07-09" + po_doclist[0]["supplier"] = "_Test Supplier" + po_doclist[0]["transaction_date"] = "2013-07-07" + po_doclist[1]["qty"] = 27.0 + po_doclist[2]["qty"] = 1.5 + po_doclist[1]["schedule_date"] = "2013-07-09" + po_doclist[2]["schedule_date"] = "2013-07-09" # check for stopped status of Material Request diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index efc3a8b6f0..862bd846f8 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -27,7 +27,7 @@ class TestPurchaseReceipt(unittest.TestCase): self.assertEquals(len(pi), len(pr.doclist)) # modify rate - pi[1].rate = 200 + pi[1]["rate"] = 200 self.assertRaises(frappe.ValidationError, frappe.bean(pi).submit) def test_purchase_receipt_no_gl_entry(self): diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index fe596c4c7d..39d494c69a 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -32,6 +32,7 @@ def get_item_details(args): if isinstance(args, basestring): args = json.loads(args) + args = frappe._dict(args) if not args.get("transaction_type"):