ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Simple Custom Script not working

Hi

I am in the process of writing my own ( first !!! ) server script.

ERPNext: v12.10.1 (version-12)

Frappe Framework: v12.8.4 (version-1

At this stage I am stuck and would like to ask some assistance…

At the end of the day I would like to have my own P&L statement, so the outcome is a report
with 3 columns populated with values.

What I have done so far…

I have created a “script report” under Report-List.
I have copied the existing P&L Report code ( .js , .json , .py ) into this folder on the server,
taking care to correct all references made to the report-name. When I click on
“Show report” it shows the existing report. This tells me that my basic structure is OK.

I then replace the original (clean) .js , .json and .py files that the system created when I
created the report and started writing my own code.

Very basic of course but just to feel my way around.

I managed to get this appearing on my report …![own-script_1|690x355]

(upload://zdMgvBtznrPu8Wxx8ZompKpnIlO.jpeg)

I do get my date-selection fields but I am also expecting 3 columns with one row
of simple data

My .JS file looks like this.

My JSON file looks like this

My PY file looks like this

Could someone point me in the right direction abut what I am doing wrong?

Update …
SHFT+CTRL+J did show me something … it did not like that I used

            "default":dateutil.year_start()

so I did a bit of searching and came up with this

            "default": frappe.datetime.get_today()

But this gives todays date. The first one I used, gives you a nice calendar drop-down

I have been googling to find the class definition for datetime to see the equivalent in
datetime of such a calendar dropdown. Just wondering what everyone else is using?