[Staging] Patch fix - Shopify Settings (#15338)

* keep enable_shopify in Shopify Settings disabled by default

* patch fix for shopify refactor

* minor fallback fix
This commit is contained in:
Zarrar 2018-09-07 13:19:33 +05:30 committed by Nabin Hait
parent 203baa9a3a
commit 7737620ff4
4 changed files with 20 additions and 8 deletions

View File

@ -289,7 +289,7 @@ class SalesInvoice(SellingController):
super(SalesInvoice, self).set_missing_values(for_validate)
print_format = pos.get("print_format_for_online")
print_format = pos.get("print_format_for_online") if pos else None
if not print_format and not cint(frappe.db.get_value('Print Format', 'POS Invoice', 'disabled')):
print_format = 'POS Invoice'

View File

@ -49,7 +49,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"default": "",
"fieldname": "enable_shopify",
"fieldtype": "Check",
"hidden": 0,
@ -1219,7 +1219,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2018-04-11 19:04:53.396557",
"modified": "2018-09-07 09:11:49.403176",
"modified_by": "Administrator",
"module": "ERPNext Integrations",
"name": "Shopify Settings",
@ -1253,5 +1253,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0
"track_seen": 0,
"track_views": 0
}

View File

@ -538,7 +538,7 @@ erpnext.patches.v11_0.make_location_from_warehouse
erpnext.patches.v11_0.make_asset_finance_book_against_old_entries
erpnext.patches.v11_0.check_buying_selling_in_currency_exchange
erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-2018
erpnext.patches.v11_0.refactor_erpnext_shopify
erpnext.patches.v11_0.refactor_erpnext_shopify #2018-09-07
erpnext.patches.v11_0.rename_overproduction_percent_field
erpnext.patches.v11_0.update_backflush_subcontract_rm_based_on_bom
erpnext.patches.v10_0.update_status_in_purchase_receipt

View File

@ -19,6 +19,8 @@ def execute():
frappe.db.sql("truncate `tabShopify Log`")
setup_app_type()
else:
disable_shopify()
def setup_app_type():
try:
@ -29,5 +31,14 @@ def setup_app_type():
shopify_settings.ignore_permissions = True
shopify_settings.save()
except Exception:
frappe.db.set_value("Shopify Shopify", None, "enable_shopify", 0)
frappe.db.set_value("Shopify Settings", None, "enable_shopify", 0)
frappe.log_error(frappe.get_traceback())
def disable_shopify():
# due to frappe.db.set_value wrongly written and enable_shopify being default 1
# Shopify Settings isn't properly configured and leads to error
shopify = frappe.get_doc('Shopify Settings')
if shopify.app_type == "Public" or shopify.app_type == None or \
(shopify.enable_shopify and not (shopify.shopify_url or shopify.api_key)):
frappe.db.set_value("Shopify Settings", None, "enable_shopify", 0)