JINJA Formatting - Pulling data from another module?

Hi there,

I’m customizing a Task Report, and I’d like to include the customer name and customer contact information (address, phone number, etc.).

Looking at the models, I can find the Projects module, and within it find multiple customer_info and customer fields. But if I try to use one of them (and my formatting could be WAY off!) I get the following error:

{{ no such element: erpnext.projects.doctype.task.task.Task object['customer_name'] }}

So, is there a proper way to get at this data for reporting? My end goal is that after service personnel visit a site and work, they can email a report to our customer contact detailing their visit.

No need to use jinja code to make report. Better option is, add the necessary fields on the task form and using report builder feature add those fields on the report.

1 Like

Hi Rohit,

Thank you for your response! I watched the video you linked and then tried some of the steps on my installation. When I add a column to the report in report builder, I only seem to be able to see the fields that are part of the task module, so I cannot add fields from the CRM module or the Accounts module, whichever one would include my customer’s name, location, city, state, zip, phone number, contact name, and contact email. This is the data I’m looking to include on the task report so that when it’s sent to the customer, they know which location the work was performed for.

Let me know how I can help explain the problem better, if the above is not clear. I have the capability of making videos of what I’m attempting if it would help! :slight_smile:

-Paul

I understand your problem therefore I told you to add necessary fields like customer, location, city etc. on the task form. Using custom field feature you can add the new fields on the task form.
You can also make report using server side scripting language(python), where you can pull the data from another module.

Server side report example


JS Code


PY code

Did you manage to overcome your requirement?

This seems like standard requirement for everyone and if there is a step by step tutorial to allow people to get summarized/detailed data from multiple doctypes and format it on a pre-printed stationary, the it will be useful for many not-yet-paperless offices.