From 43b508089e5737c9263c13376a3fcb15be709343 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 24 Oct 2016 14:04:46 +0530 Subject: [PATCH 1/3] [Fix] Pricing rule discount issue --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 7 +++++++ erpnext/public/js/controllers/taxes_and_totals.js | 4 ---- erpnext/public/js/controllers/transaction.js | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index b4fe148916..f298bc88f9 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -165,6 +165,13 @@ def get_pricing_rule_for_item(args): }) else: item_details.discount_percentage = pricing_rule.discount_percentage + elif args.get('pricing_rule'): + if frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), 'price_or_discount') == 'Discount Percentage': + item_details.discount_percentage = 0.0 + + item_details.margin_rate_or_amount = 0.0 + item_details.margin_type = None + return item_details def get_pricing_rules(args): diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 4e1288cedf..64d48ea75a 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -15,10 +15,6 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ }, apply_pricing_rule_on_item: function(item){ - if(!item.margin_type){ - item.margin_rate_or_amount = 0.0; - } - if(item.margin_type == "Percentage"){ item.total_margin = item.price_list_rate + item.price_list_rate * ( item.margin_rate_or_amount / 100); }else{ diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 7ac90318d4..49a5af4394 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -720,7 +720,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ "brand": d.brand, "qty": d.qty, "parenttype": d.parenttype, - "parent": d.parent + "parent": d.parent, + "pricing_rule": d.pricing_rule }); // if doctype is Quotation Item / Sales Order Iten then add Margin Type and rate in item_list From fe86debf5de1d106f8605af6c25fbbf44a87a37c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 24 Oct 2016 17:47:02 +0530 Subject: [PATCH 2/3] [fix] Duplicate salary components --- erpnext/patches/v7_0/rename_salary_components.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v7_0/rename_salary_components.py b/erpnext/patches/v7_0/rename_salary_components.py index ecf2faf34a..4e9ceb2173 100644 --- a/erpnext/patches/v7_0/rename_salary_components.py +++ b/erpnext/patches/v7_0/rename_salary_components.py @@ -78,9 +78,12 @@ def execute(): for doctype, cols in dt_cols_de.items(): source_cols = "`" + "`, `".join(standard_cols_de + cols) + "`" - - frappe.db.sql("""INSERT INTO `tabSalary Component` ({0}) SELECT {1} FROM `tab{2}`""" - .format(target_cols, source_cols, doctype)) + try: + frappe.db.sql("""INSERT INTO `tabSalary Component` ({0}) SELECT {1} FROM `tab{2}`""" + .format(target_cols, source_cols, doctype)) + except Exception, e: + if e.args[0]==1062: + pass update_customizations() From f3882d2699e15a1fa045400e285bd1dbec6dbb23 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 26 Oct 2016 17:10:44 +0600 Subject: [PATCH 3/3] bumped to version 7.0.63 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index df729860b7..40b0879ad5 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.62' +__version__ = '7.0.63' def get_default_company(user=None): '''Get default company for user'''