[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:

View File

@@ -19,6 +19,7 @@ def pre_process(doc):
if cached_details:
doc.hub_category = cached_details.hub_category
doc.image_list = cached_details.image_list
return doc

View File

@@ -24,10 +24,20 @@
"local_fieldname": "image",
"remote_fieldname": "image"
},
{
"is_child_table": 0,
"local_fieldname": "image_list",
"remote_fieldname": "image_list"
},
{
"is_child_table": 0,
"local_fieldname": "item_group",
"remote_fieldname": "item_group"
},
{
"is_child_table": 0,
"local_fieldname": "hub_category",
"remote_fieldname": "hub_category"
}
],
"idx": 1,
@@ -35,7 +45,7 @@
"mapping_name": "Item to Hub Item",
"mapping_type": "Push",
"migration_id_field": "hub_sync_id",
"modified": "2018-08-01 16:37:09.170546",
"modified": "2018-08-19 22:20:25.727581",
"modified_by": "Administrator",
"name": "Item to Hub Item",
"owner": "Administrator",

View File

@@ -9,7 +9,7 @@
"mapping": "Item to Hub Item"
}
],
"modified": "2018-08-01 16:37:09.027512",
"modified": "2018-08-19 22:20:25.644602",
"modified_by": "Administrator",
"module": "Hub Node",
"name": "Hub Sync",

View File

@@ -84,7 +84,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "images",
"fieldname": "image_list",
"fieldtype": "Long Text",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -93,7 +93,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Images",
"label": "Image List",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -120,7 +120,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-08-19 19:30:01.449904",
"modified": "2018-08-19 22:24:06.207307",
"modified_by": "Administrator",
"module": "Hub Node",
"name": "Hub Tracked Item",