Creating new report, need help getting started

Hi all, I’m just starting out with ERPNext. I need to create a report that will show some basic information about a single item at a time. I’m having trouble figuring out what pieces need to be put together to actually make anything happen though. Would anyone be willing to walk me through the steps?

Here is the behavior I’m looking for:

  • I’ve added a button to the Item DocType. So far there is no code associated with the button, that’s one thing I need help with.

  • Upon clicking the button, I’d like the Item Code of the Item (100017 in this case) to be passed as the input to my report.

  • The report then opens, showing some selected information about the item.

If anyone can get me as far as just pulling the description, it should be a big help getting me unstuck.

The report will ultimately need to also pull information from items listed in the default BOM for the parent item, but for now I would like to just get something basic to happen.

Thanks very much for any possible assistance! Very impressed with Frappe/ERPNext!!

Okay, I managed it. I’ll post the details in case someone searches for a similar problem later on, hopefully it might help.

I didn’t get anywhere with the button added to the DocType from the UI, so I deleted that. Here are the actual steps I’ve taken, starting from a clean install of Frappe and ERPNext. I’ll post the code as screenshots since the forum software “helpfully” messes up the indentation :slight_smile:

Created a new app named erpnext_engineering using these commands:

  • bench new-app erpnext_engineering
  • bench --site site1.local install-app erpnext_engineering

Created Engineering module in the erpnext_engineering app (go to “New Module Def” from the awesome bar)

Made a customized version of the Item DocType, saving it under module Engineering. I then copied all files from “apps/erpnext/erpnext/Stock/doctype/item/” to “apps/erpnext_engineering/erpnext_engineering/engineering/doctype/item/” so that the custom DocType starts out as an identical copy of the standard one.

Created a new report(awesome bar–>New Report):

  • Report Name = Item Information Report
  • Ref DocType = Item
  • Is Standard = Yes
  • Module = Engineering
  • Report Type = Script Report

Edited file …/engineering/report/item_information_report.js
item_info_report_js

Edited …/engineering/report/item_information_report.py

Edited file item.js in my custom Item doctype(…/engineering/doctype/item/item.js), adding the following to the “refresh” function:
item_js_edit