mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 23:31:20 +00:00
fix(project): use user.email for invitations and skip disabled users. (#54561)
* fix(project): use user.email for invitations and skip disabled users.
* Update erpnext/projects/doctype/project/project.py
* fix(project): remove duplicate loop causing indentation error
* fix(project): resolve pre-commit hook failure
---------
(cherry picked from commit 231dd1856f)
Co-authored-by: Hemil-Sangani <hemil@sanskartechnolab.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -364,9 +364,14 @@ class Project(Document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for user in self.users:
|
for user in self.users:
|
||||||
|
# process only users who haven't received the welcome email yet
|
||||||
if user.welcome_email_sent == 0:
|
if user.welcome_email_sent == 0:
|
||||||
|
# fetch canonical User data (enabled status + latest email)
|
||||||
|
user_info = frappe.db.get_value("User", user.user, ["enabled", "email"], as_dict=True)
|
||||||
|
# send email only if user is enabled and has a valid email
|
||||||
|
if user_info and user_info.enabled and user_info.email:
|
||||||
frappe.sendmail(
|
frappe.sendmail(
|
||||||
user.user,
|
recipients=[user_info.email],
|
||||||
subject=_("Project Collaboration Invitation"),
|
subject=_("Project Collaboration Invitation"),
|
||||||
content=content,
|
content=content,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user