Override function of Controllers transaction.js

Hi, I would like to override this javascript function > validate_company_and_party
The goal is not to include the Sales Invoice in this validation.
![“Purchase Order”,“Purchase Invoice”,“Sales Invoice”].includes(me.frm.doc.doctype))
How I can achieve this? Thank you

validate_company_and_party() {
		var me = this;
		var valid = true;

		if (frappe.flags.ignore_company_party_validation) {
			return valid;
		}

		$.each(["company", "customer"], function(i, fieldname) {
			if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) &&  !["Purchase Order","Purchase Invoice"].includes(me.frm.doc.doctype)) {
				if (!me.frm.doc[fieldname]) {
					frappe.msgprint(__("Please specify") + ": " +
						__(frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name)) +
						". " + __("It is needed to fetch Item Details."));
					valid = false;
				}
			}
		});
		return valid;
	}