From 7656377f3f1d55b8e253e4ab4ebb062f483439a2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 10 Jun 2014 15:48:37 +0530 Subject: [PATCH] Show website route for generator via set_intro, fix in Support Email Settings --- .../setup/doctype/item_group/item_group.js | 7 +++---- .../setup/doctype/item_group/item_group.json | 19 ++++++++++--------- erpnext/stock/doctype/item/item.js | 10 +++++----- erpnext/stock/doctype/item/item.py | 1 + .../support_email_settings.py | 3 ++- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index 2aaf558642..954f6c58b5 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -9,10 +9,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { frappe.set_route("Sales Browser", "Item Group"); }, "icon-sitemap") - if(!doc.__islocal && doc.show_in_website) { - cur_frm.appframe.add_button("View In Website", function() { - window.open(doc.__onload.website_route); - }, "icon-globe"); + if (!doc.__islocal && doc.show_in_website) { + cur_frm.set_intro(__("Published on website at: {0}", + [repl('/%(website_route)s', doc.__onload)])); } } diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json index 82f3c031be..66e39674f2 100644 --- a/erpnext/setup/doctype/item_group/item_group.json +++ b/erpnext/setup/doctype/item_group/item_group.json @@ -21,14 +21,6 @@ "reqd": 1, "search_index": 0 }, - { - "fieldname": "page_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Page Name", - "permlevel": 0, - "read_only": 1 - }, { "fieldname": "cb0", "fieldtype": "Column Break", @@ -79,6 +71,15 @@ "permlevel": 0, "search_index": 0 }, + { + "depends_on": "show_in_website", + "fieldname": "page_name", + "fieldtype": "Data", + "in_list_view": 0, + "label": "Page Name", + "permlevel": 0, + "read_only": 1 + }, { "depends_on": "show_in_website", "fieldname": "parent_website_route", @@ -162,7 +163,7 @@ "in_create": 1, "issingle": 0, "max_attachments": 3, - "modified": "2014-05-27 03:49:12.086044", + "modified": "2014-06-10 05:37:03.763185", "modified_by": "Administrator", "module": "Setup", "name": "Item Group", diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 2b499c168e..2eeb84128d 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -16,11 +16,6 @@ cur_frm.cscript.refresh = function(doc) { } - if(!doc.__islocal && doc.show_in_website) { - cur_frm.appframe.add_button("View In Website", function() { - window.open(doc.__onload.website_route); - }, "icon-globe"); - } cur_frm.cscript.edit_prices_button(); if (!doc.__islocal && doc.is_stock_item == 'Yes') { @@ -28,6 +23,11 @@ cur_frm.cscript.refresh = function(doc) { (doc.__onload && doc.__onload.sle_exists=="exists") ? false : true); } + if (!doc.__islocal && doc.show_in_website) { + cur_frm.set_intro(__("Published on website at: {0}", + [repl('/%(website_route)s', doc.__onload)])); + } + erpnext.item.toggle_reqd(cur_frm); } diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 6d6db94f30..f43b531392 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -13,6 +13,7 @@ class WarehouseNotSet(frappe.ValidationError): pass class Item(WebsiteGenerator): def onload(self): + super(Item, self).onload() self.get("__onload").sle_exists = self.check_if_sle_exists() def autoname(self): diff --git a/erpnext/support/doctype/support_email_settings/support_email_settings.py b/erpnext/support/doctype/support_email_settings/support_email_settings.py index 8763c6d269..be8889190d 100644 --- a/erpnext/support/doctype/support_email_settings/support_email_settings.py +++ b/erpnext/support/doctype/support_email_settings/support_email_settings.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import frappe from frappe import _ +from frappe.utils import cint from frappe.model.document import Document from frappe.utils.email_lib.receive import POP3Mailbox import _socket, poplib @@ -16,7 +17,7 @@ class SupportEmailSettings(Document): """ Checks support ticket email settings """ - if self.sync_support_mails and self.mail_server: + if cint(self.sync_support_mails) and self.mail_server and not frappe.local.flags.in_patch: inc_email = frappe._dict(self.as_dict()) # inc_email.encode() inc_email.host = self.mail_server