Merge pull request #17250 from saurabh6790/patches_fix

fix: woocommerce settings patch
This commit is contained in:
Nabin Hait
2019-04-17 17:30:14 +05:30
committed by GitHub

View File

@@ -1,10 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cint
def execute(): def execute():
woocommerce_setting_enable_sync = frappe.db.sql("SELECT t.value FROM tabSingles t WHERE doctype = 'Woocommerce Settings' AND field = 'enable_sync'", as_dict=True) frappe.reload_doc("erpnext_integrations", "doctype","woocommerce_settings")
if len(woocommerce_setting_enable_sync) and woocommerce_setting_enable_sync[0].value == '1': doc = frappe.get_doc("Woocommerce Settings")
frappe.db.sql("""UPDATE tabSingles
SET value = (SELECT t.value FROM tabSingles t WHERE doctype = 'Woocommerce Settings' AND field = 'modified_by') if cint(doc.enable_sync):
WHERE doctype = 'Woocommerce Settings' doc.creation_user = doc.modified_by
AND field = 'creation_user';""") doc.save(ignore_permissions=True)