From d2b200266461b9eaafab2f8e349189f7e017022d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:00:47 +0530 Subject: [PATCH] fix: auto reorder material request mail issue (backport #43066) (#43068) fix: auto reorder material request mail issue (#43066) fix: auto reorder matreial request mail issue (cherry picked from commit a8055a6da975a4a59ce17052d31d7672f3b46ba7) Co-authored-by: rohitwaghchaure --- erpnext/stock/reorder_item.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index 7bc8b71917c0..ed87906731e4 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -354,9 +354,14 @@ def get_email_list(company): def get_comapny_wise_users(company): + companies = [company] + + if parent_company := frappe.db.get_value("Company", company, "parent_company"): + companies.append(parent_company) + users = frappe.get_all( "User Permission", - filters={"allow": "Company", "for_value": company, "apply_to_all_doctypes": 1}, + filters={"allow": "Company", "for_value": ("in", companies), "apply_to_all_doctypes": 1}, fields=["user"], )