From 80142af9b8c1d6ea241d1155ddb3ca80a0fad5ba Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 20 Jun 2014 19:37:53 +0530 Subject: [PATCH] Minor fixes --- .../doctype/pricing_rule/pricing_rule.json | 19 +++++++++---------- .../doctype/pricing_rule/pricing_rule.py | 13 +++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json index e15cea83b8..2d318c6360 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json @@ -126,18 +126,18 @@ "options": "Supplier Type", "permlevel": 0 }, - { - "fieldname": "max_qty", - "fieldtype": "Float", - "label": "Max Qty", - "permlevel": 0 - }, { "fieldname": "min_qty", "fieldtype": "Float", "label": "Min Qty", "permlevel": 0 }, + { + "fieldname": "max_qty", + "fieldtype": "Float", + "label": "Max Qty", + "permlevel": 0 + }, { "fieldname": "col_break1", "fieldtype": "Column Break", @@ -235,7 +235,7 @@ "icon": "icon-gift", "idx": 1, "istable": 0, - "modified": "2014-06-19 15:00:09.962572", + "modified": "2014-06-20 19:36:22.502381", "modified_by": "Administrator", "module": "Accounts", "name": "Pricing Rule", @@ -244,8 +244,8 @@ { "create": 1, "delete": 1, - "export": 0, - "import": 0, + "export": 1, + "import": 1, "permlevel": 0, "read": 1, "report": 1, @@ -290,7 +290,6 @@ "permlevel": 0, "read": 1, "report": 1, - "restrict": 1, "role": "System Manager", "write": 1 } diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 77b52b18f8..967d583aab 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -66,7 +66,7 @@ class PricingRule(Document): if self.price_or_discount == "Discount Percentage" and self.item_code: max_discount = frappe.db.get_value("Item", self.item_code, "max_discount") if max_discount and flt(self.discount_percentage) > flt(max_discount): - throw(_("Max discount allowed for item: {0} is {1}%".format(self.item_code, max_discount))) + throw(_("Max discount allowed for item: {0} is {1}%").format(self.item_code, max_discount)) #-------------------------------------------------------------------------------- @@ -141,7 +141,8 @@ def get_pricing_rule_for_item(args): item_details.pricing_rule = pricing_rule.name if pricing_rule.price_or_discount == "Price": item_details.update({ - "price_list_rate": pricing_rule.price*flt(args.plc_conversion_rate)/flt(args.conversion_rate), + "price_list_rate": pricing_rule.price/flt(args.conversion_rate) \ + if args.conversion_rate else 0.0, "discount_percentage": 0.0 }) else: @@ -167,10 +168,10 @@ def get_pricing_rules(args): conditions = "" for field in ["company", "customer", "supplier", "supplier_type", "campaign", "sales_partner"]: - if args.get(field): - conditions += " and ifnull("+field+", '') in (%("+field+")s, '')" - else: - conditions += " and ifnull("+field+", '') = ''" + if args.get(field): + conditions += " and ifnull("+field+", '') in (%("+field+")s, '')" + else: + conditions += " and ifnull("+field+", '') = ''" for parenttype in ["Customer Group", "Territory"]: group_condition = _get_tree_conditions(parenttype)