Unique customer number error

I want to achieve a unique customer number using the following server-side script

import random
from frappe import _

def generate_unique_customer_number(docname):
    customer = frappe.get_doc('Customer', docname)
    if not customer.customer_number:
        customer.customer_number = generate_unique_random_number()
        return customer.customer_number

def generate_unique_random_number():
    random_number = random.randint(10000000, 99999999)  # Generate random 8-digit number
    existing_customer = frappe.get_all('Customer', filters={'customer_number': random_number})

    if not existing_customer:
        return random_number
        return generate_unique_random_number()  # Recursively generate a new random number if not unique

and client-side script

frappe.ui.form.on('YourDocType', {
    refresh: function(frm) {
        // Check if customer number is already set
        if (!frm.doc.customer_number) {
            // Generate and set the customer number
                method: 'crm.customer.utils.generate_unique_customer_number',
                args: {
                    docname: frm.doc.name
                callback: function(response) {
                    if (response.message) {
                        frm.set_value('customer_number', response.message);

but getting error
Failed to get method for command crm.customer.utils.generate_unique_customer_number with App crm is not installed