Merge pull request #23144 from anupamvs/product-image
fix: Homepage Featured Product image fetch issue
This commit is contained in:
commit
fe0ecc2ff7
@ -21,34 +21,6 @@ frappe.ui.form.on('Homepage', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('Homepage Featured Product', {
|
frappe.ui.form.on('Homepage Featured Product', {
|
||||||
item_code: function(frm, cdt, cdn) {
|
|
||||||
var featured_product = frappe.model.get_doc(cdt, cdn);
|
|
||||||
if (featured_product.item_code) {
|
|
||||||
frappe.call({
|
|
||||||
method: 'frappe.client.get_value',
|
|
||||||
args: {
|
|
||||||
'doctype': 'Item',
|
|
||||||
'filters': {'name': featured_product.item_code},
|
|
||||||
'fieldname': [
|
|
||||||
'item_name',
|
|
||||||
'web_long_description',
|
|
||||||
'description',
|
|
||||||
'image',
|
|
||||||
'thumbnail'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
callback: function(r) {
|
|
||||||
if (!r.exc) {
|
|
||||||
$.extend(featured_product, r.message);
|
|
||||||
if (r.message.web_long_description) {
|
|
||||||
featured_product.description = r.message.web_long_description;
|
|
||||||
}
|
|
||||||
frm.refresh_field('products');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
view: function(frm, cdt, cdn){
|
view: function(frm, cdt, cdn){
|
||||||
var child= locals[cdt][cdn]
|
var child= locals[cdt][cdn]
|
||||||
|
@ -1,301 +1,116 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"actions": [],
|
||||||
"allow_import": 0,
|
"autoname": "hash",
|
||||||
"allow_rename": 0,
|
"creation": "2016-04-22 05:57:06.261401",
|
||||||
"autoname": "hash",
|
"doctype": "DocType",
|
||||||
"beta": 0,
|
"document_type": "Document",
|
||||||
"creation": "2016-04-22 05:57:06.261401",
|
"editable_grid": 1,
|
||||||
"custom": 0,
|
"engine": "InnoDB",
|
||||||
"docstatus": 0,
|
"field_order": [
|
||||||
"doctype": "DocType",
|
"item_code",
|
||||||
"document_type": "Document",
|
"col_break1",
|
||||||
"editable_grid": 1,
|
"item_name",
|
||||||
|
"view",
|
||||||
|
"section_break_5",
|
||||||
|
"description",
|
||||||
|
"column_break_7",
|
||||||
|
"image",
|
||||||
|
"thumbnail",
|
||||||
|
"route"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"bold": 1,
|
||||||
"bold": 1,
|
"fieldname": "item_code",
|
||||||
"collapsible": 0,
|
"fieldtype": "Link",
|
||||||
"fieldname": "item_code",
|
"in_filter": 1,
|
||||||
"fieldtype": "Link",
|
"in_list_view": 1,
|
||||||
"hidden": 0,
|
"label": "Item Code",
|
||||||
"ignore_user_permissions": 0,
|
"oldfieldname": "item_code",
|
||||||
"ignore_xss_filter": 0,
|
"oldfieldtype": "Link",
|
||||||
"in_filter": 1,
|
"options": "Item",
|
||||||
"in_list_view": 1,
|
"print_width": "150px",
|
||||||
"label": "Item Code",
|
"reqd": 1,
|
||||||
"length": 0,
|
"search_index": 1,
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "item_code",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Item",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"print_width": "150px",
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 1,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0,
|
|
||||||
"width": "150px"
|
"width": "150px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fieldname": "col_break1",
|
||||||
"bold": 0,
|
"fieldtype": "Column Break"
|
||||||
"collapsible": 0,
|
},
|
||||||
"fieldname": "col_break1",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fetch_from": "item_code.item_name",
|
||||||
"bold": 0,
|
"fetch_if_empty": 1,
|
||||||
"collapsible": 0,
|
"fieldname": "item_name",
|
||||||
"fieldname": "item_name",
|
"fieldtype": "Data",
|
||||||
"fieldtype": "Data",
|
"in_list_view": 1,
|
||||||
"hidden": 0,
|
"label": "Item Name",
|
||||||
"ignore_user_permissions": 0,
|
"oldfieldname": "item_name",
|
||||||
"ignore_xss_filter": 0,
|
"oldfieldtype": "Data",
|
||||||
"in_filter": 0,
|
"print_hide": 1,
|
||||||
"in_list_view": 1,
|
"print_width": "150",
|
||||||
"label": "Item Name",
|
"read_only": 1,
|
||||||
"length": 0,
|
"reqd": 1,
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "item_name",
|
|
||||||
"oldfieldtype": "Data",
|
|
||||||
"options": "",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 1,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"print_width": "150",
|
|
||||||
"read_only": 1,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0,
|
|
||||||
"width": "150"
|
"width": "150"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fieldname": "view",
|
||||||
"bold": 0,
|
"fieldtype": "Button",
|
||||||
"collapsible": 0,
|
"in_list_view": 1,
|
||||||
"fieldname": "view",
|
"label": "View"
|
||||||
"fieldtype": "Button",
|
},
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"label": "View",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"collapsible": 1,
|
||||||
"bold": 0,
|
"fieldname": "section_break_5",
|
||||||
"collapsible": 1,
|
"fieldtype": "Section Break",
|
||||||
"fieldname": "section_break_5",
|
"label": "Description"
|
||||||
"fieldtype": "Section Break",
|
},
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "Description",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fetch_from": "item_code.web_long_description",
|
||||||
"bold": 0,
|
"fieldname": "description",
|
||||||
"collapsible": 0,
|
"fieldtype": "Text Editor",
|
||||||
"fieldname": "description",
|
"in_filter": 1,
|
||||||
"fieldtype": "Text Editor",
|
"in_list_view": 1,
|
||||||
"hidden": 0,
|
"label": "Description",
|
||||||
"ignore_user_permissions": 0,
|
"oldfieldname": "description",
|
||||||
"ignore_xss_filter": 0,
|
"oldfieldtype": "Small Text",
|
||||||
"in_filter": 1,
|
"print_width": "300px",
|
||||||
"in_list_view": 1,
|
|
||||||
"label": "Description",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "description",
|
|
||||||
"oldfieldtype": "Small Text",
|
|
||||||
"options": "",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"print_width": "300px",
|
|
||||||
"read_only": 1,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0,
|
|
||||||
"width": "300px"
|
"width": "300px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fieldname": "column_break_7",
|
||||||
"bold": 0,
|
"fieldtype": "Column Break"
|
||||||
"collapsible": 0,
|
},
|
||||||
"fieldname": "column_break_7",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fetch_from": "item_code.website_image",
|
||||||
"bold": 0,
|
"fetch_if_empty": 1,
|
||||||
"collapsible": 0,
|
"fieldname": "image",
|
||||||
"fieldname": "image",
|
"fieldtype": "Attach Image",
|
||||||
"fieldtype": "Attach Image",
|
"label": "Image"
|
||||||
"hidden": 0,
|
},
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "Image",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fieldname": "thumbnail",
|
||||||
"bold": 0,
|
"fieldtype": "Attach Image",
|
||||||
"collapsible": 0,
|
"hidden": 1,
|
||||||
"fieldname": "thumbnail",
|
"label": "Thumbnail"
|
||||||
"fieldtype": "Attach Image",
|
},
|
||||||
"hidden": 1,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "Thumbnail",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"fieldname": "route",
|
||||||
"bold": 0,
|
"fieldtype": "Small Text",
|
||||||
"collapsible": 0,
|
"label": "route",
|
||||||
"fieldname": "route",
|
"read_only": 1
|
||||||
"fieldtype": "Small Text",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "route",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hide_heading": 0,
|
"index_web_pages_for_search": 1,
|
||||||
"hide_toolbar": 0,
|
"istable": 1,
|
||||||
"idx": 0,
|
"links": [],
|
||||||
"image_view": 0,
|
"modified": "2020-08-25 15:27:49.573537",
|
||||||
"in_create": 0,
|
"modified_by": "Administrator",
|
||||||
|
"module": "Portal",
|
||||||
"is_submittable": 0,
|
"name": "Homepage Featured Product",
|
||||||
"issingle": 0,
|
"owner": "Administrator",
|
||||||
"istable": 1,
|
"permissions": [],
|
||||||
"max_attachments": 0,
|
"quick_entry": 1,
|
||||||
"modified": "2016-08-09 06:09:34.731971",
|
"sort_field": "modified",
|
||||||
"modified_by": "Administrator",
|
"sort_order": "DESC"
|
||||||
"module": "Portal",
|
|
||||||
"name": "Homepage Featured Product",
|
|
||||||
"name_case": "",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"permissions": [],
|
|
||||||
"quick_entry": 1,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_onload": 0,
|
|
||||||
"sort_field": "modified",
|
|
||||||
"sort_order": "DESC",
|
|
||||||
"track_seen": 0
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user