Showing error Customer not found | Woocommerce error

New customers are not auto-created. Showing error Customer not found

Traceback (most recent call last):
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py”, line 25, in order
_order(*args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py”, line 56, in order
create_sales_order(order, woocommerce_settings, customer_name, sys_lang)
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py”, line 182, in create_sales_order
new_sales_order.insert()
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert
self.run_before_save_methods()
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 896, in run_before_save_methods
self.run_method(“validate”)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 797, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 1073, in composer
return composed(self, method, *args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 1056, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 791, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py”, line 36, in validate
super(SalesOrder, self).validate()
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 39, in validate
super(SellingController, self).validate()
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 21, in validate
super(StockController, self).validate()
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 70, in validate
self.set_missing_values(for_validate=True)
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 56, in set_missing_values
self.set_missing_lead_customer_details()
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/controllers/selling_controller.py”, line 85, in set_missing_lead_customer_details
party_address=self.customer_address, shipping_address=self.shipping_address_name)
File “/home/aadhilpm/frappe-bench/apps/erpnext/erpnext/accounts/party.py”, line 43, in get_party_details
if not ignore_permissions and not frappe.has_permission(party_type, “read”, party):
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/init.py”, line 605, in has_permission
out = frappe.permissions.has_permission(doctype, ptype, doc=doc, verbose=verbose, user=user)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/permissions.py”, line 26, in inner
result = func(*args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/permissions.py”, line 62, in has_permission
doc = frappe.get_doc(meta.name, doc)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/init.py”, line 753, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 71, in get_doc
return controller(*args, **kwargs)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 106, in init
self.load_from_db()
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/model/document.py”, line 149, in load_from_db
frappe.throw(
("{0} {1} not found").format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/init.py”, line 376, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable)
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/init.py”, line 355, in msgprint
_raise_exception()
File “/home/aadhilpm/frappe-bench/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Customer AAdhil not found

any solution?

I get that same error, but when I set Customer Naming to “Customer Name” in the Selling Settings, it works perfectly.
However, if two customers with the same name order something in Woocommerce, the Sales Order always gets linked to the first customer created with that name, which is not acceptable, so some kind of customer number or naming series is a must.

Apparently the Woocommerce integration is not working when you set Customer Naming to “Naming Series”.
How can we create customer numbers in ERPNext for customers who bought something in Woocommerce? Does it have to be set in Woocommerce itself and then transferred?

When a purchase is made in Woocommerce the customer is generated an ID that is imported to ERPNext, if another person with the same name is registered in woocommerce is generated another ID. Another way would be to place an additional field as the ID # in woocommerce to be imported to ERPNExt.

Hi Leo,
thanks for your answer.
Somehow the woocommerce customer ID doesn’t make it into ERPNext in my case:

The data received by ERPNext shows 'customer_id': 0,
Is there a special setting needed in woocommerce to make it transmit the Customer ID?

Are you using the woocommerce integrated connector?

I have tried it with the native ERPNext integration as well as the Woocommerce connector by libracore.
Do you use guest orders with your shop or only allow registered users to order?

In woocommerce is enabled the 2 options, with registration and without registration; I’m going to make a test purchase as a guest…maybe I have the same error and I have not noticed. :sunglasses:

Hi Leo, could you tell me how your customers are being named?

1 Like

Hello, I have it set as: Customer Name.
Captura

Thank you very much Leo.
I have now solved this issue by not using the Webhook-based Woocommerce Integration but the custom app Woocommerce Connector which only uses the API.
With this I am able to use automatic naming as well and insert Woocommerce customer ID into the ERPNExt customer naming.

Excellent news that you were able to solve the issues, a query as you managed to insert the Woocommerce client ID in the client name ERPNExt.
Regards