Skip to content

feat(Lead)!: send notifications to lead owner#53959

Open
barredterra wants to merge 1 commit intofrappe:developfrom
barredterra:lead-notification-email
Open

feat(Lead)!: send notifications to lead owner#53959
barredterra wants to merge 1 commit intofrappe:developfrom
barredterra:lead-notification-email

Conversation

@barredterra
Copy link
Copy Markdown
Collaborator

@barredterra barredterra commented Mar 31, 2026

Summary

Implements get_notification_email on the Lead DocType (introduced in frappe/frappe#38365) so that email thread notifications are sent to the Lead Owner instead of the document creator.

Previously, the user who created a Lead (doc.owner) received all email thread notifications, even if a different user was assigned as Lead Owner. This is disruptive when one person creates leads but another person manages them.

Now, if a Lead Owner is set, that user receives thread notifications. If no Lead Owner is set, it falls back to the document creator.

Depends on: frappe/frappe#38365

I would be happy with a backport to v16 or even v15, but it's a breaking change and easy to customize (via hooks) for companies who want it today.

Test plan

  • Create a Lead as User A, set Lead Owner to User B
  • Receive an email on that Lead
  • Verify User B gets the notification, User A does not
  • Remove Lead Owner, verify fallback to User A

Ref: VOI-73

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Mar 31, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

A new get_notification_email() method was added to the Lead class in erpnext/crm/doctype/lead/lead.py. The method retrieves and returns the email address of the user designated as the lead owner from the User doctype. If no lead owner is assigned, the method returns None. This addition introduces 7 new lines of code.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and specifically describes the main change: adding notification functionality to send notifications to the lead owner, which aligns with the newly added get_notification_email() method.
Description check ✅ Passed The pull request description clearly explains the purpose, problem being solved, and implementation details of the changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.05%. Comparing base (75fa2b2) to head (c81283a).
⚠️ Report is 24 commits behind head on develop.

Files with missing lines Patch % Lines
erpnext/crm/doctype/lead/lead.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #53959      +/-   ##
===========================================
- Coverage    79.05%   79.05%   -0.01%     
===========================================
  Files         1159     1159              
  Lines       124753   124757       +4     
===========================================
+ Hits         98627    98628       +1     
- Misses       26126    26129       +3     
Files with missing lines Coverage Δ
erpnext/crm/doctype/lead/lead.py 67.07% <25.00%> (-0.71%) ⬇️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@barredterra barredterra requested a review from mihir-kandoi April 2, 2026 17:33
@barredterra barredterra changed the title feat: send notifications to lead owner feat(Lead)!: send notifications to lead owner Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-tests This PR needs automated unit-tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant