fix(woocommerce integration): fix strange travis error
the patch was working locally. But, in was failing on travis. The strange thing was that the patch running in travis was looking for woocommerce_settings in the path 'frappe.core.doctype.woocommerce_settings.woocommerce_settings'
(cherry picked from commit df3e8853aeedb4991e7f8b1c878adb7ba849a063)
diff --git a/erpnext/patches/v11_1/woocommerce_set_creation_user.py b/erpnext/patches/v11_1/woocommerce_set_creation_user.py
index e398a03..e50d5ae 100644
--- a/erpnext/patches/v11_1/woocommerce_set_creation_user.py
+++ b/erpnext/patches/v11_1/woocommerce_set_creation_user.py
@@ -2,7 +2,9 @@
import frappe
def execute():
- woocommerce_settings = frappe.get_single("Woocommerce Settings")
- if woocommerce_settings.enable_sync:
- woocommerce_settings.creation_user = woocommerce_settings.modified_by
- woocommerce_settings.save()
\ No newline at end of file
+ woocommerce_setting_enable_sync = frappe.db.sql("SELECT t.value FROM tabSingles t WHERE doctype = 'Woocommerce Settings' AND field = 'enable_sync'", as_dict=True)
+ if len(woocommerce_setting_enable_sync) and woocommerce_setting_enable_sync[0].value == '1':
+ frappe.db.sql("""UPDATE tabSingles
+ SET value = (SELECT t.value FROM tabSingles t WHERE doctype = 'Woocommerce Settings' AND field = 'modified_by')
+ WHERE doctype = 'Woocommerce Settings'
+ AND field = 'creation_user';""")
\ No newline at end of file