Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve attach_print and allow using its output in email.make #21837

Merged
merged 9 commits into from
Aug 20, 2023

Conversation

barredterra
Copy link
Collaborator

@barredterra barredterra commented Jul 27, 2023

  • Use the print_language context manager in frappe.attach_print

  • Add missing letterhead param to frappe.attach_print

  • Move filename and ignore_print_permissions closer to usage

  • In frappe.sendmail we can supply the output of frappe.attach_print as attachment. This PR enables the same functionality for email.make.

    from frappe.core.doctype.communication.email import make
    
    make(
    	doctype="My DocType",
    	name="My Name",
    	attachments=[frappe.attach_print("My Other DocType", "My Other Name")]
    )

no-docs

- Use print_language context manager
- Move filename and ignore_print_permissions closer to usage
@barredterra barredterra requested review from a team and surajshetty3416 and removed request for a team July 27, 2023 16:07
@github-actions github-actions bot added the add-test-cases Add test case to validate fix or enhancement label Jul 27, 2023
@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #21837 (f7384b4) into develop (8243d3d) will decrease coverage by 0.21%.
The diff coverage is 84.61%.

❗ Current head f7384b4 differs from pull request most recent head 5944d38. Consider uploading reports for the commit 5944d38 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #21837      +/-   ##
===========================================
- Coverage    62.10%   61.89%   -0.21%     
===========================================
  Files          767      765       -2     
  Lines        72993    72904      -89     
  Branches      6302     6271      -31     
===========================================
- Hits         45330    45122     -208     
- Misses       24215    24250      +35     
- Partials      3448     3532      +84     
Flag Coverage Δ
server 65.26% <84.61%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@barredterra barredterra added backport version-14-hotfix backport to version 14 and removed add-test-cases Add test case to validate fix or enhancement labels Aug 1, 2023
@barredterra barredterra changed the title refactor: attach_print feat: improve attach_print and allow using it for email.make Aug 3, 2023
@barredterra barredterra changed the title feat: improve attach_print and allow using it for email.make feat: improve attach_print and allow using its output in email.make Aug 3, 2023
@stale
Copy link

stale bot commented Aug 16, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@barredterra barredterra merged commit 6fbfc31 into frappe:develop Aug 20, 2023
21 checks passed
@barredterra barredterra deleted the refactor-attach-print branch August 22, 2023 06:56
@barredterra barredterra removed the backport version-14-hotfix backport to version 14 label Aug 22, 2023
ankush pushed a commit that referenced this pull request Aug 29, 2023
…backport #21837) (#22144)

* refactor: attach_print

- Use print_language context manager
- Move filename and ignore_print_permissions closer to usage

* feat: letterhead param for attach_print

* feat: handle attachments from frappe.attach_print

In email.make()

* test: add_attachments to communication

* fix: use None as default for attachments

Instead of "[]" to avoid useless JSON parsing.

* chore: update docstings

* refactor: add type hints to add_attachments
frappe-pr-bot pushed a commit that referenced this pull request Aug 30, 2023
# [14.47.0](v14.46.0...v14.47.0) (2023-08-30)

### Bug Fixes

* add missing parameters for search_widget ([#22052](#22052)) ([#22181](#22181)) ([755f1cc](755f1cc))
* **Assignment Rule:** also run `on_cancel` and `on_update_after_submit` (backport [#22064](#22064)) ([#22098](#22098)) ([08e5d1f](08e5d1f))
* check workflow state field to avoid error ([5a82a45](5a82a45))
* clear server script cache on delete ([#22207](#22207)) ([#22208](#22208)) ([48a1b55](48a1b55))
* delete doctype after migrating ([#22195](#22195)) ([#22196](#22196)) ([b3679f9](b3679f9))
* dont allow rename+merge for case changes ([#22237](#22237)) ([1c7d225](1c7d225))
* **Email Inline Embed:** escape regex expression ([#22201](#22201)) ([2404259](2404259))
* limit job count in RQ failed registry (backport [#22162](#22162)) ([#22199](#22199)) ([451a6f7](451a6f7))
* translation in assignments ([#22183](#22183)) ([cae7290](cae7290))
* typerror on custom reports ([cd746a5](cd746a5))
* **UX:** Highlight which permission is missing ([#22240](#22240)) ([999c24e](999c24e))

### Features

* improve attach_print and allow using its output in email.make (backport [#21837](#21837)) ([#22144](#22144)) ([be21740](be21740))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants