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

This commit is contained in:
Anand Doshi 2011-10-25 10:58:17 +05:30
commit dac955b897
2 changed files with 9 additions and 7 deletions

View File

@ -118,12 +118,14 @@ class DocType:
# validate negative stock (validate if stock is going -ve in between for back dated entries will consider only is_cancel = 'No' entries) # validate negative stock (validate if stock is going -ve in between for back dated entries will consider only is_cancel = 'No' entries)
# -------------------------------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------------------------------
def validate_negative_stock(self, cqty, s): def validate_negative_stock(self, cqty, s):
if cqty + s['actual_qty'] < 0 and s['is_cancelled'] != 'Yes': diff = cqty + s['actual_qty']
msgprint(cqty) if diff < 0 and (abs(diff) > 0.0001) and s['is_cancelled'] != 'Yes':
msgprint(s['actual_qty']) msgprint("""
msgprint('Cannot complete this transaction because stock will become negative in future transaction for Item <b>%s</b> in Warehouse <b>%s</b> on <b>%s %s</b>' % \ Cannot complete this transaction because stock will
(self.doc.item_code, self.doc.warehouse, s['posting_date'], s['posting_time'])) become negative (%s) in future transaction for Item
raise Exception <b>%s</b> in Warehouse <b>%s</b> on <b>%s %s</b>""" % \
(str(diff), self.doc.item_code, self.doc.warehouse,
s['posting_date'], s['posting_time']), raise_exception=1)
# ------------------------------------ # ------------------------------------
# get serialized inventory values # get serialized inventory values

View File

@ -108,7 +108,7 @@ class DocType:
if not prev_sle: if not prev_sle:
return 0.0 return 0.0
fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]')) fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]'))
in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0 in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack) or 0
elif val_method == 'Moving Average': elif val_method == 'Moving Average':
prev_sle = bin_obj.get_prev_sle(posting_date, posting_time) prev_sle = bin_obj.get_prev_sle(posting_date, posting_time)
in_rate = prev_sle and prev_sle.get('valuation_rate', 0) or 0 in_rate = prev_sle and prev_sle.get('valuation_rate', 0) or 0