[hub] sync multiple image urls

- using a simple multiselect currently
This commit is contained in:
Prateeksha Singh
2018-08-19 22:31:33 +05:30
parent 0a60d1cd96
commit a525d12f69
6 changed files with 43 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import unicode_literals
import frappe, requests, json
from frappe.utils import now
from frappe.frappeclient import FrappeClient
from frappe.desk.form.load import get_attachments
@frappe.whitelist()
def call_hub_method(method, params=None):
@@ -31,11 +32,13 @@ def get_valid_items(search_value=''):
valid_items = filter(lambda x: x.image and x.description, items)
def attach_source_type(item):
def prepare_item(item):
item.source_type = "local"
item.attachments = get_attachments('Item', item.item_code)
return item
valid_items = map(lambda x: attach_source_type(x), valid_items)
valid_items = map(lambda x: prepare_item(x), valid_items)
return valid_items
@frappe.whitelist()
@@ -52,7 +55,7 @@ def publish_selected_items(items_to_publish):
'doctype': 'Hub Tracked Item',
'item_code': item_code,
'hub_category': item.get('hub_category'),
# 'images': item.get('images')
'image_list': item.get('image_list')
}).insert()
try: