I want to add customer when student is created. The primay reason for that is to see customer invocies as students are not reflecte otherwise. I have added a server side script as mentioned below but when I add student, it is added succeessfully and also customer is created, but I get below error.
Error Details
Failed to get method for command erpnext.selling.doctype.customer.customer.create_customer with module ‘erpnext.selling.doctype.customer.customer’ has no attribute ‘create_customer’
Script
full_customer_name = f"{doc.first_name.strip()} ({doc.custom_roll_no.strip()})"
Check if customer already exists
if not frappe.db.exists(“Customer”, full_customer_name):
customer = frappe.new_doc(“Customer”)
customer.customer_name = full_customer_name
customer.customer_type = “Individual”
customer.customer_group = “Individual”
customer.territory = “All Territories”
customer.custom_company = doc.custom_company
customer.save()
# Optional: link this customer to the student if needed
doc.custom_customer = full_customer_name
doc.save()
frappe.msgprint(f"Customer '{full_customer_name}' created successfully.")