[hub] sync in progress

This commit is contained in:
Prateeksha Singh
2018-07-26 16:25:22 +05:30
parent d1224ca662
commit b750425288
4 changed files with 86 additions and 161 deletions

View File

@@ -2,7 +2,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, requests, json
import frappe, requests, json, time
from frappe.utils import now, nowdate, cint
from frappe.utils.nestedset import get_root_of
from frappe.contacts.doctype.contact.contact import get_default_contact
@@ -35,7 +35,8 @@ def get_list(doctype, start=0, limit=20, fields=["*"], filters="{}", order_by=No
@frappe.whitelist()
def get_valid_items(search_value=''):
items = frappe.get_list(
'Item', fields=["*"],
'Item',
fields=["*"],
filters={
'item_name': ['like', '%' + search_value + '%'],
'publish_in_hub': 0
@@ -53,12 +54,14 @@ def get_valid_items(search_value=''):
return valid_items
@frappe.whitelist()
def publish_selected_items(items_to_publish, items_to_unpublish):
for item_code in json.loads(items_to_publish):
frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
def publish_selected_items(items_to_publish):
# for item_code in json.loads(items_to_publish):
# frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
hub_settings = frappe.get_doc('Hub Settings')
hub_settings.sync()
time.sleep(3)
# hub_settings = frappe.get_doc('Hub Settings')
# hub_settings.sync()
return