From 0da11f1b10fe97883f7e2a8e6796974fd7e00979 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 13 Aug 2015 13:25:43 +0530 Subject: [PATCH] [fix] Reset price list rate based on Pricing Rule type --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 1 + erpnext/controllers/accounts_controller.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 70d6fb9c14..349a89b1dc 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -147,6 +147,7 @@ def get_pricing_rule_for_item(args): if pricing_rule: item_details.pricing_rule = pricing_rule.name + item_details.pricing_rule_for = pricing_rule.price_or_discount if pricing_rule.price_or_discount == "Price": item_details.update({ "price_list_rate": pricing_rule.price/flt(args.conversion_rate) \ diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index ecd9e1a1ad..2c9e7d4f61 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -153,9 +153,10 @@ class AccountsController(TransactionBase): item.set(fieldname, value) if ret.get("pricing_rule"): - for field in ["base_price_list_rate", "price_list_rate", - "discount_percentage", "base_rate", "rate"]: - item.set(field, ret.get(field)) + item.set("discount_percentage", ret.get("discount_percentage")) + if ret.get("pricing_rule_for") == "Price": + item.set("pricing_list_rate", ret.get("pricing_list_rate")) + def set_taxes(self): if not self.meta.get_field("taxes"):