From f3fa6ac4c20a87ed55c54ca738b9bedcbc777da3 Mon Sep 17 00:00:00 2001 From: rahib-hassan Date: Wed, 20 Apr 2022 16:01:12 +0530 Subject: [PATCH] fix: account setting seperation gl discount account creation --- erpnext/controllers/accounts_controller.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 8558cea0f0..78645e0d4f 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1079,9 +1079,14 @@ class AccountsController(TransactionBase): return amount, base_amount def make_discount_gl_entries(self, gl_entries): - enable_discount_accounting = cint( - frappe.db.get_single_value("Selling Settings", "enable_discount_accounting") - ) + if self.doctype == "Purchase Invoice": + enable_discount_accounting = cint( + frappe.db.get_single_value("Buying Settings", "enable_discount_accounting") + ) + elif self.doctype == "Sales Invoice": + enable_discount_accounting = cint( + frappe.db.get_single_value("Selling Settings", "enable_discount_accounting") + ) if enable_discount_accounting: if self.doctype == "Purchase Invoice":