Merge pull request #15768 from rohitwaghchaure/market_place_settings_error

[Fix] Marketplace settings permission error
This commit is contained in:
Faris Ansari 2018-10-23 12:07:21 +05:30 committed by GitHub
commit d3e3c1ba72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe, requests, json, time
from frappe.model.document import Document
from frappe.utils import add_years, now, get_datetime, get_datetime_str
from frappe.utils import add_years, now, get_datetime, get_datetime_str, cint
from frappe import _
from frappe.frappeclient import FrappeClient
from erpnext.utilities.product import get_price, get_qty_in_stock
@ -84,3 +84,11 @@ class MarketplaceSettings(Document):
def unregister(self):
"""Disable the User on hubmarket.org"""
pass
@frappe.whitelist()
def is_marketplace_enabled():
if not hasattr(frappe.local, 'is_marketplace_enabled'):
frappe.local.is_marketplace_enabled = cint(frappe.db.get_single_value('Marketplace Settings',
'disable_marketplace'))
return frappe.local.is_marketplace_enabled

View File

@ -32,8 +32,9 @@ frappe.views.marketplaceFactory = class marketplaceFactory extends frappe.views.
};
function is_marketplace_disabled() {
return frappe.model.with_doc('Marketplace Settings')
.then(doc => doc.disable_marketplace);
return frappe.call({
method: "erpnext.hub_node.doctype.marketplace_settings.marketplace_settings.is_marketplace_enabled"
}).then(r => r.message)
}
$(document).on('toolbar_setup', () => {