From a0dc79332df5b2a567a13a0b052bfc9bdf4e3153 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Tue, 8 Mar 2022 14:28:34 +0530 Subject: [PATCH 1/2] fix: customer credit limit validation on update --- erpnext/selling/doctype/customer/customer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 7742f26ad1..634c4819e6 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -218,7 +218,9 @@ class Customer(TransactionBase): else: company_record.append(limit.company) - outstanding_amt = get_customer_outstanding(self.name, limit.company) + outstanding_amt = get_customer_outstanding( + self.name, limit.company, ignore_outstanding_sales_order=limit.bypass_credit_limit_check + ) if flt(limit.credit_limit) < outstanding_amt: frappe.throw(_("""New credit limit is less than current outstanding amount for the customer. Credit limit has to be atleast {0}""").format(outstanding_amt)) From aadca02018f7c3bc0011c4f31b72fa6a7bedf459 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Mar 2022 11:27:15 +0530 Subject: [PATCH 2/2] fix: add filters in default_discount_account (#30095) (#30125) (cherry picked from commit 3d8eaa5392fcc420820ac86eb01a6cf67cec1cc7) Co-authored-by: Mohamed-D-Ouf <65343412+Mohamed-D-Ouf@users.noreply.github.com> --- erpnext/setup/doctype/item_group/item_group.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index 885d874720..f570c2faec 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -14,6 +14,16 @@ frappe.ui.form.on("Item Group", { ] } } + frm.fields_dict['item_group_defaults'].grid.get_field("default_discount_account").get_query = function(doc, cdt, cdn) { + const row = locals[cdt][cdn]; + return { + filters: { + 'report_type': 'Profit and Loss', + 'company': row.company, + "is_group": 0 + } + }; + } frm.fields_dict["item_group_defaults"].grid.get_field("expense_account").get_query = function(doc, cdt, cdn) { const row = locals[cdt][cdn]; return {