diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index 14d23d39610..66cd5011bdb 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -503,7 +503,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ var me = this; var valid = true; - $.each(["company", "customer", "supplier"], function(i, fieldname) { + $.each(["company", "customer"], function(i, fieldname) { if(frappe.meta.has_field(me.frm.doc.doctype, fieldname)) { if (!me.frm.doc[fieldname]) { msgprint(frappe._("Please specify") + ": " + diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index f211caec5a7..5680da8ed55 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _, throw from frappe.utils import flt, cint, add_days +from frappe.model.meta import has_field import json @frappe.whitelist() @@ -32,9 +33,10 @@ def get_item_details(args): if isinstance(args, basestring): args = json.loads(args) args = frappe._dict(args) - + if not args.get("transaction_type"): - args.transaction_type = "buying" if args.get("supplier") else "selling" + args.transaction_type = "buying" if has_field(args.get("doctype"), "supplier") \ + else "selling" if not args.get("price_list"): args.price_list = args.get("selling_price_list") or args.get("buying_price_list")