fix(print): handle custom format with custom module (backport #31372) #31376
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Problem
Create a custom doctype in a custom module
Create a print format for that doctype with "custom_format" checked (enabled Jinja/HTML field)
Try to print:
Reason
This happens because the code does not handle this case and tries to look for the template in the file system.
The Solution
Do not try to look for a file if the module is custom.
Co-authored-by: Aman amanupadhayay2906@gmail.com
Co-authored-by: Khushbu mittalk1802@gmail.com
Co-authored-by: Manya girdharmanya28@gmail.com
Co-authored-by: Ritika ritika@korecent.com
Co-authored-by: Siddharth siddharth.khati03@gmail.com
Co-authored-by: Yashvi yashvi@korecent.com
This is an automatic backport of pull request #31372 done by [Mergify](https://mergify.com).