use get_global_default instead of control panel

This commit is contained in:
Nabin Hait 2013-03-06 13:15:08 +05:30
parent 7804401d03
commit 87b9cd5ba1
6 changed files with 30 additions and 17 deletions

View File

@ -929,7 +929,7 @@ def send_notification(new_rv):
"""Notify concerned persons about recurring invoice generation""" """Notify concerned persons about recurring invoice generation"""
subject = "Invoice : " + new_rv.doc.name subject = "Invoice : " + new_rv.doc.name
com = new_rv.doc.company # webnotes.conn.get_value('Control Panel', '', 'letter_head') com = new_rv.doc.company
hd = '''<div><h2>%s</h2></div> hd = '''<div><h2>%s</h2></div>
<div><h3>Invoice: %s</h3></div> <div><h3>Invoice: %s</h3></div>

View File

@ -2,6 +2,7 @@ from __future__ import unicode_literals
import webnotes import webnotes
from webnotes import _ from webnotes import _
from webnotes.utils import flt, comma_and from webnotes.utils import flt, comma_and
import webnotes.defaults
@webnotes.whitelist() @webnotes.whitelist()
def get_template(): def get_template():
@ -35,7 +36,7 @@ def get_template():
%(columns)s %(columns)s
''' % { ''' % {
"template_type": template_type, "template_type": template_type,
"user_fmt": webnotes.conn.get_value('Control Panel', None, 'date_format'), "user_fmt": webnotes.defaults.get_global_default('date_format'),
"default_company": webnotes.conn.get_default("company"), "default_company": webnotes.conn.get_default("company"),
"naming_options": naming_options.replace("\n", ", "), "naming_options": naming_options.replace("\n", ", "),
"voucher_type": voucher_type.replace("\n", ", "), "voucher_type": voucher_type.replace("\n", ", "),

View File

@ -0,0 +1,11 @@
import webnotes
import webnotes.defaults
def execute():
# sesison expiry missing
if not webnotes.defaults.get_global_default("session_expiry"):
gd = webnotes.bean("Global Defaults", "Global Defaults")
gd.doc.session_expiry = webnotes.conn.get_value('Control Panel', None, 'session_expiry') \
or '06:00'
gd.save()

View File

@ -207,4 +207,5 @@ patch_list = [
"patches.march_2013.p01_c_form", "patches.march_2013.p01_c_form",
"execute:webnotes.conn.sql('update tabDocPerm set `submit`=1, `cancel`=1, `amend`=1 where parent=\"Time Log\"')", "execute:webnotes.conn.sql('update tabDocPerm set `submit`=1, `cancel`=1, `amend`=1 where parent=\"Time Log\"')",
"execute:webnotes.delete_doc('DocType', 'Attendance Control Panel')", "execute:webnotes.delete_doc('DocType', 'Attendance Control Panel')",
"patches.march_2013.p02_get_global_default",
] ]

View File

@ -75,7 +75,7 @@ class DocType:
def send_sms(self, receiver_list, msg, sender_name = ''): def send_sms(self, receiver_list, msg, sender_name = ''):
receiver_list = self.validate_receiver_nos(receiver_list) receiver_list = self.validate_receiver_nos(receiver_list)
arg = { 'account_name' : webnotes.conn.get_value('Control Panel',None,'account_id'), arg = {
'receiver_list' : receiver_list, 'receiver_list' : receiver_list,
'message' : msg, 'message' : msg,
'sender_name' : sender_name or self.get_sender_name() 'sender_name' : sender_name or self.get_sender_name()