Ignore mandatory fields when uploading attachments

How can I prevent the “Missing Fields” pop up from popping up every time I upload an attachment in a doctype with other mandatory fields. In frappe 13 I was able to upload an attachment in a doctype with mandatory fields and it won’t complain and give a pop up. I’ve now upgraded to frappe 15 and it complains. I have other frappe 15 apps and they complain also. I guess it’s a frappe 15 thing. Also Placing the attach field at the bottom is not an option since I have 12 mandatory attach fields, every time upload an attachment it tells me the others are missing.

I’ve tried different client scripts but non seem to work.
e.g. below

frappe.ui.form.on('Visitor Visa Application', {
    // Disable mandatory check during the file upload
    validate: function(frm) {
        let image_fields = [
            'sponsor_passport_photo', 
            'sponsor_passport_biodata_page', 
            'extension_letter', 
            'entire_passport', 
            'medical_report', 
            'marriage_certificate', 
            'passport_photo', 
            'bank_statement', 
            'children_birth_certificates', 
            'certificate_of_character', 
            'spouse_birth_certificate', 
            'applicant_birth_cert'
        ];
        
        for (let field of image_fields) {
            if (frm.doc[field] && frm.doc[field].length > 0) {
                // Temporarily remove mandatory fields validation
                frm.ignore_mandatory = true;
                break;
            }
        }
    },
    // Re-enable mandatory check after the image is uploaded
    after_save: function(frm) {
        frm.ignore_mandatory = false;
    }
});

another

frappe.ui.form.on('Visitor Visa Application', {
    setup: function(frm) {
        // List of image attachment fields
        let image_fields = [
            'sponsor_passport_photo',
            'sponsor_passport_biodata_page',
            'extension_letter',
            'entire_passport',
            'medical_report',
            'marriage_certificate',
            'passport_photo',
            'bank_statement',
            'children_birth_certificates',
            'certificate_of_character',
            'spouse_birth_certificate',
            'applicant_birth_cert'
        ];

        // Attach onchange event to each image field
        image_fields.forEach(field => {
            frm.fields_dict[field].df.onchange = function() {
                // Temporarily disable mandatory fields
                frm.set_df_property('height', 'reqd', 0);
                frm.set_df_property('first_name', 'reqd', 0);
                frm.set_df_property('dob', 'reqd', 0);
                // Add more fields as needed

                // Save the form to upload the image
                frm.save().then(() => {
                    // Re-enable mandatory fields after saving
                    frm.set_df_property('height', 'reqd', 1);
                    frm.set_df_property('first_name', 'reqd', 1);
                    frm.set_df_property('dob', 'reqd', 1);
                    // Add more fields as needed
                });
            };
        });
    }
});

Thanks in Advance