replaced get_value

This commit is contained in:
Anand Doshi
2012-11-30 17:16:03 +05:30
parent a2c6349342
commit 535fbb1b00
19 changed files with 29 additions and 30 deletions

View File

@@ -149,7 +149,7 @@ class DocType:
# Check user role for approval process
def get_authorized_user(self):
# Check logged-in user is authorized
if get_value('Global Defaults', None, 'credit_controller') in webnotes.user.get_roles():
if webnotes.conn.get_value('Global Defaults', None, 'credit_controller') in webnotes.user.get_roles():
return 1
# Check Credit limit for customer
@@ -160,7 +160,7 @@ class DocType:
cr_limit = sql("select t1.credit_limit from tabCustomer t1, `tabAccount` t2 where t2.name='%s' and t1.name = t2.master_name" % account)
credit_limit = cr_limit and flt(cr_limit[0][0]) or 0
if not credit_limit:
credit_limit = get_value('Company', company, 'credit_limit')
credit_limit = webnotes.conn.get_value('Company', company, 'credit_limit')
credit_limit_from = 'global settings in the Company'
# If outstanding greater than credit limit and not authorized person raise exception

View File

@@ -24,7 +24,6 @@ from webnotes.model.code import get_obj
from webnotes import msgprint
sql = webnotes.conn.sql
class DocType:
@@ -72,7 +71,7 @@ class DocType:
if bgt_flag and bgt_flag[0]['monthly_bgt_flag'] in ['Stop', 'Warn']:
# get start date and last date
st_date = get_value('Fiscal Year', cfy, 'year_start_date').strftime('%Y-%m-%d')
st_date = webnotes.conn.get_value('Fiscal Year', cfy, 'year_start_date').strftime('%Y-%m-%d')
lt_date = sql("select LAST_DAY('%s')" % post_dt)
# get Actual

View File

@@ -108,9 +108,9 @@ class DocType:
#----------------------------------------------------------------------------------------------
def check_freezing_date(self, adv_adj):
if not adv_adj:
acc_frozen_upto = get_value('Global Defaults', None, 'acc_frozen_upto')
acc_frozen_upto = webnotes.conn.get_value('Global Defaults', None, 'acc_frozen_upto')
if acc_frozen_upto:
bde_auth_role = get_value( 'Global Defaults', None,'bde_auth_role')
bde_auth_role = webnotes.conn.get_value( 'Global Defaults', None,'bde_auth_role')
if getdate(self.doc.posting_date) <= getdate(acc_frozen_upto) and not bde_auth_role in webnotes.user.get_roles():
msgprint("You are not authorized to do/modify back dated accounting entries before %s." % getdate(acc_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)

View File

@@ -294,7 +294,7 @@ class DocType:
master_type, acc_type = chk_type and cstr(chk_type[0][0]) or '', chk_type and cstr(chk_type[0][1]) or ''
if master_type in ['Supplier', 'Customer']:
if not self.doc.pay_to_recd_from:
self.doc.pay_to_recd_from = get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
if acc_type == 'Bank or Cash':
dcc = TransactionBase().get_company_currency(self.doc.company)

View File

@@ -60,7 +60,7 @@ class DocType(TransactionBase):
def get_cust(self):
ret = {}
if self.doc.credit_to:
acc = get_value('Account',self.doc.credit_to,['master_name', 'credit_days'])
acc = webnotes.conn.get_value('Account',self.doc.credit_to,['master_name', 'credit_days'])
ret['supplier'] = acc[0]
ret['due_date'] = add_days(cstr(self.doc.posting_date), acc and cint(acc[1]) or 0)
@@ -384,7 +384,7 @@ class DocType(TransactionBase):
# get tds rate
# -------------
def get_tds_rate(self):
return {'rate' : flt(get_value('Account', self.doc.tax_code, 'tax_rate'))}
return {'rate' : flt(webnotes.conn.get_value('Account', self.doc.tax_code, 'tax_rate'))}
# set aging date
#-------------------

View File

@@ -149,7 +149,7 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
# get start date
start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
if not start_date:
msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
raise Exception