From 06f432f4c752b2ffe54a719fc931907248330f67 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 24 Oct 2011 11:59:22 +0530 Subject: [PATCH 1/2] fixes to valuation control --- erpnext/stock/doctype/valuation_control/valuation_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/valuation_control/valuation_control.py b/erpnext/stock/doctype/valuation_control/valuation_control.py index 27170cea82..f37b7e7c7f 100644 --- a/erpnext/stock/doctype/valuation_control/valuation_control.py +++ b/erpnext/stock/doctype/valuation_control/valuation_control.py @@ -108,7 +108,7 @@ class DocType: if not prev_sle: return 0.0 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': prev_sle = bin_obj.get_prev_sle(posting_date, posting_time) in_rate = prev_sle and prev_sle.get('valuation_rate', 0) or 0 From 9666e657ce0a04b9949d8f5be8ca59f804852845 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 24 Oct 2011 14:35:04 +0530 Subject: [PATCH 2/2] fixed fpe in bin --- erpnext/stock/doctype/bin/bin.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index cf9509a332..13c0fee2cf 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -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) # -------------------------------------------------------------------------------------------------------------------------------------- def validate_negative_stock(self, cqty, s): - if cqty + s['actual_qty'] < 0 and s['is_cancelled'] != 'Yes': - msgprint(cqty) - msgprint(s['actual_qty']) - msgprint('Cannot complete this transaction because stock will become negative in future transaction for Item %s in Warehouse %s on %s %s' % \ - (self.doc.item_code, self.doc.warehouse, s['posting_date'], s['posting_time'])) - raise Exception + diff = cqty + s['actual_qty'] + if diff < 0 and (abs(diff) > 0.0001) and s['is_cancelled'] != 'Yes': + msgprint(""" + Cannot complete this transaction because stock will + become negative (%s) in future transaction for Item + %s in Warehouse %s on %s %s""" % \ + (str(diff), self.doc.item_code, self.doc.warehouse, + s['posting_date'], s['posting_time']), raise_exception=1) # ------------------------------------ # get serialized inventory values