From 3f077479f4c564a4bc7764a73d4faa334d6b125f Mon Sep 17 00:00:00 2001 From: L Mwangi Date: Sat, 26 Aug 2023 17:15:55 +0300 Subject: [PATCH] fix: On woocommerce test ping issued during a webhook creation fix: On woocommerce test ping issued during a webhook creation --- .../connectors/woocommerce_connection.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py index 6d977e022ff..b140df20682 100644 --- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py +++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py @@ -41,7 +41,10 @@ def _order(*args, **kwargs): if frappe.flags.woocomm_test_order_data: order = frappe.flags.woocomm_test_order_data event = "created" - + # Ignore the test ping issued during WooCommerce webhook configuration + # Ref: https://github.com/woocommerce/woocommerce/issues/15642 + if frappe.request.data.decode('utf-8').startswith('webhook_id='): + return "success" elif frappe.request and frappe.request.data: verify_request() try: @@ -81,7 +84,9 @@ def link_customer_and_address(raw_billing_data, raw_shipping_data, customer_name customer.save() if customer_exists: - frappe.rename_doc("Customer", old_name, customer_name) + # Fixes https://github.com/frappe/erpnext/issues/33708 + if old_name != customer_name: + frappe.rename_doc("Customer", old_name, customer_name) for address_type in ( "Billing", "Shipping",