Merge pull request #3610 from nabinhait/variants

Adding rows not allowed in Variant table in Manage Variants and Item
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 70d5f4a..809e352 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -605,7 +605,7 @@
    "label": "Total Advance", 
    "oldfieldname": "total_advance", 
    "oldfieldtype": "Currency", 
-   "options": "", 
+   "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 1
@@ -618,7 +618,7 @@
    "no_copy": 1, 
    "oldfieldname": "outstanding_amount", 
    "oldfieldtype": "Currency", 
-   "options": "currency", 
+   "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 1
@@ -671,7 +671,7 @@
    "no_copy": 1, 
    "oldfieldname": "paid_amount", 
    "oldfieldtype": "Currency", 
-   "options": "currency", 
+   "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 0
@@ -711,7 +711,7 @@
    "fieldtype": "Currency", 
    "label": "Write Off Amount", 
    "no_copy": 1, 
-   "options": "currency", 
+   "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 0
@@ -1253,7 +1253,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-07-03 03:25:40.519956", 
+ "modified": "2015-07-09 17:33:28.583808", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.py b/erpnext/crm/doctype/newsletter_list/newsletter_list.py
index 3a580d3..bf78676 100644
--- a/erpnext/crm/doctype/newsletter_list/newsletter_list.py
+++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.py
@@ -12,8 +12,8 @@
 class NewsletterList(Document):
 	def onload(self):
 		singles = [d.name for d in frappe.db.get_all("DocType", "name", {"issingle": 1})]
-		self.get("__onload").import_types = [d.parent \
-			for d in frappe.db.get_all("DocField", "parent", {"options": "Email"}) if d.parent not in singles]
+		self.get("__onload").import_types = [{"value": d.parent, "label": "{0} ({1})".format(d.parent, d.label)} \
+			for d in frappe.db.get_all("DocField", ("parent", "label"), {"options": "Email"}) if d.parent not in singles]
 
 	def import_from(self, doctype):
 		"""Extract email ids from given doctype and add them to the current list"""
diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json
index 7dfc0b8..710f4e2 100644
--- a/erpnext/hr/doctype/employee/employee.json
+++ b/erpnext/hr/doctype/employee/employee.json
@@ -290,6 +290,7 @@
    "label": "Company Email", 
    "oldfieldname": "company_email", 
    "oldfieldtype": "Data", 
+   "options": "Email", 
    "permlevel": 0, 
    "reqd": 0
   }, 
@@ -385,6 +386,7 @@
    "fieldname": "personal_email", 
    "fieldtype": "Data", 
    "label": "Personal Email", 
+   "options": "Email", 
    "permlevel": 0
   }, 
   {
@@ -674,7 +676,7 @@
  ], 
  "icon": "icon-user", 
  "idx": 1, 
- "modified": "2015-02-20 05:02:14.205144", 
+ "modified": "2015-07-09 02:25:20.987412", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee", 
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 17fbc5e..6d16cd4 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -250,7 +250,8 @@
 cur_frm.fields_dict['production_item'].get_query = function(doc) {
 	return {
 		filters:[
-			['Item', 'is_pro_applicable', '=', 'Yes']
+			['Item', 'is_pro_applicable', '=', 'Yes'],
+			['Item', 'has_variants', '=', 'No']
 		]
 	}
 }
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 0274b7e..0f805d0 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -30,6 +30,7 @@
 		validate_status(self.status, ["Draft", "Submitted", "Stopped",
 			"In Process", "Completed", "Cancelled"])
 
+		self.validate_production_item()
 		if self.bom_no:
 			validate_bom_no(self.production_item, self.bom_no)
 
@@ -319,6 +320,13 @@
 	def delete_time_logs(self):
 		for time_log in frappe.get_all("Time Log", ["name"], {"production_order": self.name}):
 			frappe.delete_doc("Time Log", time_log.name)
+	
+	def validate_production_item(self):
+		if frappe.db.get_value("Item", self.production_item, "is_pro_applicable")=='No':
+			frappe.throw(_("Item is not allowed to have Production Order."))
+		
+		if frappe.db.get_value("Item", self.production_item, "has_variants"):
+			frappe.throw(_("Production Order cannot be raised against a Item Template"))
 
 @frappe.whitelist()
 def get_item_details(item):
diff --git a/erpnext/utilities/doctype/contact/contact.json b/erpnext/utilities/doctype/contact/contact.json
index c71ed60..d2296ca 100644
--- a/erpnext/utilities/doctype/contact/contact.json
+++ b/erpnext/utilities/doctype/contact/contact.json
@@ -75,7 +75,7 @@
    "permlevel": 0
   }, 
   {
-   "depends_on": "eval:!doc.supplier && !doc.sales_partner", 
+   "depends_on": "", 
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "label": "Customer", 
@@ -86,7 +86,7 @@
    "print_hide": 0
   }, 
   {
-   "depends_on": "eval:!doc.supplier && !doc.sales_partner", 
+   "depends_on": "", 
    "fieldname": "customer_name", 
    "fieldtype": "Data", 
    "in_list_view": 0, 
@@ -102,7 +102,7 @@
    "width": "50%"
   }, 
   {
-   "depends_on": "eval:!doc.customer && !doc.sales_partner", 
+   "depends_on": "", 
    "fieldname": "supplier", 
    "fieldtype": "Link", 
    "label": "Supplier", 
@@ -111,7 +111,7 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "depends_on": "eval:!doc.customer && !doc.sales_partner", 
+   "depends_on": "", 
    "fieldname": "supplier_name", 
    "fieldtype": "Data", 
    "in_list_view": 0, 
@@ -120,7 +120,7 @@
    "read_only": 1
   }, 
   {
-   "depends_on": "eval:!doc.customer && !doc.supplier", 
+   "depends_on": "", 
    "fieldname": "sales_partner", 
    "fieldtype": "Link", 
    "label": "Sales Partner", 
@@ -177,7 +177,7 @@
  "idx": 1, 
  "in_create": 0, 
  "in_dialog": 0, 
- "modified": "2015-03-18 07:06:43.906702", 
+ "modified": "2015-07-09 08:15:29.026935", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "Contact",