Show website route for generator via set_intro, fix in Support Email Settings

This commit is contained in:
Anand Doshi 2014-06-10 15:48:37 +05:30
parent 82029be6f9
commit 7656377f3f
5 changed files with 21 additions and 19 deletions

View File

@ -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('<a href="/%(website_route)s" target="_blank">/%(website_route)s</a>', doc.__onload)]));
}
}

View File

@ -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",

View File

@ -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('<a href="/%(website_route)s" target="_blank">/%(website_route)s</a>', doc.__onload)]));
}
erpnext.item.toggle_reqd(cur_frm);
}

View File

@ -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):

View File

@ -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