Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-10-16 09:01:50 +02:00
commit fdb3cd50c7
4 changed files with 27 additions and 23 deletions

View File

@ -439,13 +439,7 @@ def manage_recurring_invoices():
def notify_errors(inv, owner): def notify_errors(inv, owner):
import webnotes import webnotes
from webnotes.utils import get_request_site_address import website
url = get_request_site_address()
if not url or url=='http://localhost':
new_url = webnotes.conn.get_value('Website Settings', 'Website Settings',
'subdomain')
if new_url:
url = new_url
exception_msg = """ exception_msg = """
Dear User, Dear User,
@ -467,11 +461,15 @@ def notify_errors(inv, owner):
Regards, Regards,
Administrator Administrator
""" % (inv, url, inv) """ % (inv, website.get_site_address(), inv)
subj = "[Urgent] Error while creating recurring invoice from %s" % inv subj = "[Urgent] Error while creating recurring invoice from %s" % inv
import webnotes.utils
recipients = webnotes.utils.get_system_managers_list() from webnotes.profile import get_system_managers
recipients += [webnotes.conn.get_value("Profile", owner, "email")] recipients = get_system_managers()
owner_email = webnotes.conn.get_value("Profile", owner, "email")
if not owner_email in recipients:
recipients.append(owner_email)
assign_task_to_owner(inv, exception_msg, recipients) assign_task_to_owner(inv, exception_msg, recipients)
sendmail(recipients, subject=subj, msg = exception_msg) sendmail(recipients, subject=subj, msg = exception_msg)

View File

@ -140,8 +140,8 @@ class DocType:
import webnotes import webnotes
companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1) companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
import webnotes.utils from webnotes.profile import get_system_managers
system_managers = webnotes.utils.get_system_managers_list() system_managers = get_system_managers()
if not system_managers: return if not system_managers: return
from webnotes.model.doc import Document from webnotes.model.doc import Document

View File

@ -18,18 +18,12 @@ cur_frm.cscript.refresh = function(doc) {
// make sensitive fields(has_serial_no, is_stock_item, valuation_method) // make sensitive fields(has_serial_no, is_stock_item, valuation_method)
// read only if any stock ledger entry exists // read only if any stock ledger entry exists
if (!doc.__islocal) { cur_frm.toggle_enable("item_code", doc.__islocal);
set_field_permlevel("item_code", 1);
}
if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) { if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) {
var callback = function(r, rt) { var callback = function(r, rt) {
if (r.message == 'exists') permlevel = 1; var enabled = (r.message == 'exists') ? false : true;
else permlevel = 0; cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], enabled);
set_field_permlevel('has_serial_no', permlevel);
set_field_permlevel('is_stock_item', permlevel);
set_field_permlevel('valuation_method', permlevel);
} }
$c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback); $c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
} }

View File

@ -23,4 +23,16 @@ def send_message():
webnotes.msgprint('Please give us your email id so that we can write back to you', raise_exception=True) webnotes.msgprint('Please give us your email id so that we can write back to you', raise_exception=True)
d.save() d.save()
webnotes.msgprint('Thank you!') webnotes.msgprint('Thank you!')
def get_site_address():
from webnotes.utils import get_request_site_address
url = get_request_site_address()
if not url or url=='http://localhost':
new_url = webnotes.conn.get_value('Website Settings', 'Website Settings',
'subdomain')
if new_url:
url = "http://" + new_url
return url