I want a script when I choose the date in the Gregorian date that appears in the Hijri field automatically

What have you done so far or where are you stuck?

Outline what you have tried and the actual versus expected results, that will give folks clues for pointers to help.

A web search on ‘gregorian hijri python’ gives this ummalqura · PyPI

I want to have a script in erpnext

I am interested in this topic!!!
Where do you want to apply the script in ERPNext?

I think the better solution is to create a custom app to convert from Gregorian to hijri then integrate it with ERPNEXT.

This topic looks like user wants end solution. Firstly, this is not possible with current setup. Secondly, you would be better off posting the job on ERPNext jobs web page, pay for the customisation to developer and share it back to community so others can utilize it.

Most of us follow the above path whenever faced with a feature that is not available in core.

The ERPNext client site custom script will be something like:

frappe.ui.form.on('YourDocType', {
    date_my: function(frm) {
        cur_frm.set_value("date_hr", writeIslamicDate(frm.doc.date_my));

For the actual conversion, refer to e.g. angularjs - how to convert javascript date to hijri format? - Stack Overflow