fix: coupon code changes suggested by prasad (#19352)

* changes suggested by prasad

* codacy correction
diff --git a/erpnext/accounts/doctype/coupon_code/coupon_code.js b/erpnext/accounts/doctype/coupon_code/coupon_code.js
index 0bf097f..da3a9f8 100644
--- a/erpnext/accounts/doctype/coupon_code/coupon_code.js
+++ b/erpnext/accounts/doctype/coupon_code/coupon_code.js
@@ -2,6 +2,15 @@
 // For license information, please see license.txt
 
 frappe.ui.form.on('Coupon Code', {
+	setup: function(frm) {
+		frm.set_query("pricing_rule", function() {
+			return {
+				filters: [
+					["Pricing Rule","coupon_code_based", "=", "1"]
+				]
+			};
+		});
+	},
 	coupon_name:function(frm){
 		if (frm.doc.__islocal===1) {
 			frm.trigger("make_coupon_code");
diff --git a/erpnext/accounts/doctype/coupon_code/coupon_code.json b/erpnext/accounts/doctype/coupon_code/coupon_code.json
index fafc635..7dc5e9d 100644
--- a/erpnext/accounts/doctype/coupon_code/coupon_code.json
+++ b/erpnext/accounts/doctype/coupon_code/coupon_code.json
@@ -24,6 +24,7 @@
  ],
  "fields": [
   {
+   "description": "e.g. \"Summer Holiday 2019 Offer 20\"",
    "fieldname": "coupon_name",
    "fieldtype": "Data",
    "label": "Coupon Name",
@@ -50,7 +51,7 @@
    "fieldtype": "Column Break"
   },
   {
-   "description": "To be used to get discount",
+   "description": "unique e.g. SAVE20  To be used to get discount",
    "fieldname": "coupon_code",
    "fieldtype": "Data",
    "label": "Coupon Code",
@@ -62,12 +63,13 @@
    "fieldname": "pricing_rule",
    "fieldtype": "Link",
    "label": "Pricing Rule",
-   "options": "Pricing Rule"
+   "options": "Pricing Rule",
+   "reqd": 1
   },
   {
    "fieldname": "uses",
    "fieldtype": "Section Break",
-   "label": "Uses"
+   "label": "Validity and Usage"
   },
   {
    "fieldname": "valid_from",
@@ -113,7 +115,7 @@
    "read_only": 1
   }
  ],
- "modified": "2019-10-15 14:12:22.686986",
+ "modified": "2019-10-19 14:48:14.602481",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Coupon Code",