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

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

View File

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

View File

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

View File

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