replaced get_value
This commit is contained in:
parent
a2c6349342
commit
535fbb1b00
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
#-------------------
|
||||
|
@ -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
|
||||
|
@ -544,10 +544,10 @@ class DocType(TransactionBase):
|
||||
raise Exception
|
||||
|
||||
#check if tolerance added in item master
|
||||
tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
|
||||
tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0)
|
||||
|
||||
if not(tolerance):
|
||||
tolerance = flt(get_value('Global Defaults',None,'tolerance') or 0)
|
||||
tolerance = flt(webnotes.conn.get_value('Global Defaults',None,'tolerance') or 0)
|
||||
|
||||
if is_submit:
|
||||
qty = qty + flt(curr_qty)
|
||||
|
@ -70,7 +70,7 @@ class DocType:
|
||||
for d in self.get_employees():
|
||||
la = Document('Leave Allocation')
|
||||
la.employee = cstr(d[0])
|
||||
la.employee_name = get_value('Employee',cstr(d[0]),'employee_name')
|
||||
la.employee_name = webnotes.conn.get_value('Employee',cstr(d[0]),'employee_name')
|
||||
la.leave_type = self.doc.leave_type
|
||||
la.fiscal_year = self.doc.fiscal_year
|
||||
la.posting_date = nowdate()
|
||||
|
@ -52,7 +52,7 @@ class DocType(TransactionBase):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
def get_company_abbr(self):
|
||||
return get_value('Company', self.doc.company, 'abbr')
|
||||
return webnotes.conn.get_value('Company', self.doc.company, 'abbr')
|
||||
|
||||
def get_receivables_group(self):
|
||||
g = sql("select receivables_group from tabCompany where name=%s", self.doc.company)
|
||||
|
@ -115,7 +115,7 @@ class DocType(TransactionBase):
|
||||
# ====================
|
||||
def get_invoice_details(self, obj = ''):
|
||||
if obj.doc.company:
|
||||
acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + get_value('Company', obj.doc.company, 'abbr')))
|
||||
acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + webnotes.conn.get_value('Company', obj.doc.company, 'abbr')))
|
||||
obj.doc.debit_to = acc_head and acc_head[0][0] or ''
|
||||
|
||||
|
||||
@ -710,11 +710,11 @@ class StatusUpdater:
|
||||
if self.tolerance.get(item_code):
|
||||
return self.tolerance[item_code]
|
||||
|
||||
tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
|
||||
tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0)
|
||||
|
||||
if not tolerance:
|
||||
if self.global_tolerance == None:
|
||||
self.global_tolerance = flt(get_value('Global Defaults',None,'tolerance') or 0)
|
||||
self.global_tolerance = flt(webnotes.conn.get_value('Global Defaults',None,'tolerance') or 0)
|
||||
tolerance = self.global_tolerance
|
||||
|
||||
self.tolerance[item_code] = tolerance
|
||||
|
@ -100,7 +100,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
|
||||
|
@ -88,7 +88,7 @@ coltypes[col_idx[based_on]] = 'Link'
|
||||
coloptions[col_idx[based_on]]= based_on
|
||||
|
||||
# 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
|
||||
|
@ -95,7 +95,7 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
|
||||
#coloptions[col_idx['Item Group']]= 'Sales '
|
||||
|
||||
# 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
|
||||
|
@ -174,7 +174,7 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
|
||||
#coloptions[col_idx[based_on]]= based_on
|
||||
|
||||
# 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
|
||||
|
@ -75,8 +75,8 @@ class DocType:
|
||||
def validate_serial_no(self, obj, fname):
|
||||
"""check whether serial no is required"""
|
||||
for d in getlist(obj.doclist, fname):
|
||||
is_stock_item = get_value('Item', d.item_code, 'is_stock_item')
|
||||
ar_required = get_value('Item', d.item_code, 'has_serial_no')
|
||||
is_stock_item = webnotes.conn.get_value('Item', d.item_code, 'is_stock_item')
|
||||
ar_required = webnotes.conn.get_value('Item', d.item_code, 'has_serial_no')
|
||||
|
||||
# [bug fix] need to strip serial nos of all spaces and new lines for validation
|
||||
serial_no = cstr(d.serial_no).strip()
|
||||
@ -237,7 +237,7 @@ class DocType:
|
||||
for k in args.keys():
|
||||
# adds warehouse_type
|
||||
if k == 'warehouse':
|
||||
sle.fields['warehouse_type'] = get_value('Warehouse' , args[k], 'warehouse_type')
|
||||
sle.fields['warehouse_type'] = webnotes.conn.get_value('Warehouse' , args[k], 'warehouse_type')
|
||||
sle.fields[k] = args[k]
|
||||
sle_obj = get_obj(doc=sle)
|
||||
|
||||
|
@ -84,9 +84,9 @@ class DocType:
|
||||
# Nobody can do SL Entries where posting date is before freezing date except authorized person
|
||||
#----------------------------------------------------------------------------------------------
|
||||
def check_stock_frozen_date(self):
|
||||
stock_frozen_upto = get_value('Global Defaults', None, 'stock_frozen_upto') or ''
|
||||
stock_frozen_upto = webnotes.conn.get_value('Global Defaults', None, 'stock_frozen_upto') or ''
|
||||
if stock_frozen_upto:
|
||||
stock_auth_role = get_value('Global Defaults', None,'stock_auth_role')
|
||||
stock_auth_role = webnotes.conn.get_value('Global Defaults', None,'stock_auth_role')
|
||||
if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles():
|
||||
msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
|
||||
|
||||
|
@ -32,7 +32,7 @@ class DocType:
|
||||
self.doc, self.doclist = d,dl
|
||||
|
||||
def get_stock_uom(self, item_code):
|
||||
return {'current_stock_uom': cstr(get_value('Item', item_code, 'stock_uom'))}
|
||||
return {'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom'))}
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not cstr(self.doc.item_code):
|
||||
|
@ -49,7 +49,7 @@ class DocType:
|
||||
tot = 0
|
||||
for s in sr_nos:
|
||||
serial_no = s.strip()
|
||||
tot += flt(get_value('Serial No', serial_no, 'purchase_rate'))
|
||||
tot += flt(webnotes.conn.get_value('Serial No', serial_no, 'purchase_rate'))
|
||||
return tot / len(sr_nos)
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ class DocType:
|
||||
d = d.replace(x, '')
|
||||
|
||||
# mobile no validation for erpnext gateway
|
||||
if get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
if webnotes.conn.get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
mob_no = d
|
||||
else:
|
||||
if not d.startswith("0") and len(d) == 10:
|
||||
@ -104,7 +104,7 @@ class DocType:
|
||||
}
|
||||
|
||||
# personalized or erpnext gateway
|
||||
if get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
if webnotes.conn.get_value('SMS Settings', None, 'sms_gateway_url'):
|
||||
ret = self.send_via_personalized_gateway(arg)
|
||||
msgprint(ret)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user