From b6d19bcfc252a85abbc368a7e0c53bffa2c2bbe2 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 21 Jan 2016 19:59:13 +0530 Subject: [PATCH] [fixes] minor fixes, added eval on pricing rule, Sales Order Item, Quotation Item --- erpnext/accounts/doctype/pricing_rule/pricing_rule.json | 5 ++++- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 4 +++- .../selling/doctype/sales_order_item/sales_order_item.json | 1 + erpnext/selling/sales_common.js | 1 - erpnext/stock/get_item_details.py | 1 - 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json index 170bf6fa72..57b4aca563 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json @@ -731,6 +731,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "depends_on": "eval: doc.selling == 1", "fieldname": "margin", "fieldtype": "Section Break", "hidden": 0, @@ -755,6 +756,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "default": "Percentage", "fieldname": "type", "fieldtype": "Select", "hidden": 0, @@ -803,6 +805,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "default": "0", "fieldname": "rate", "fieldtype": "Float", "hidden": 0, @@ -1024,7 +1027,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-01-18 17:00:59.492217", + "modified": "2016-01-21 19:10:54.861787", "modified_by": "Administrator", "module": "Accounts", "name": "Pricing Rule", diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 78bae96ebd..7802272ef4 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -168,7 +168,9 @@ def get_pricing_rule_for_item(args): "discount_percentage": 0.0 }) else: - item_details.discount_percentage = pricing_rule.discount_percentage + # if user changed the discount percentage then set discount_percentage of user + item_details.discount_percentage = pricing_rule.discount_percentage if args.discount_percentage == pricing_rule.discount_percentage\ + else args.discount_percentage return item_details diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 84c4652641..96a9fbd5e1 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -459,6 +459,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "depends_on": "eval:doc.price_list_rate", "fieldname": "type", "fieldtype": "Select", "hidden": 0, diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 82b1342b00..3eb528f6a2 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -302,7 +302,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ callback: function(r) { if(!r.exc){ var doc = frappe.model.sync(r.message); - console.log(r.message) frappe.set_route("Form", r.message.doctype, r.message.name); } } diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 1a79a429ef..68d26ac76e 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -497,7 +497,6 @@ def apply_price_list(args, as_doc=False): # update the value if fieldname in item and fieldname not in ("name", "doctype"): item[fieldname] = children[i][fieldname] - return args else: return {