diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index afee0f5e2d..bfb4b7fd94 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -74,8 +74,8 @@ def get_data(): }, { "type": "doctype", - "name": "Landed Cost Wizard", - "description": _("Distribute transport overhead across items."), + "name": "Landed Cost Voucher", + "description": _("Update additional costs to calculate landed cost of items"), }, { "type": "doctype", diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json index f064198d8f..682a16bfd1 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json @@ -71,8 +71,9 @@ "read_only": 1 } ], + "icon": "icon-usd", "is_submittable": 1, - "modified": "2014-08-08 13:11:55.764550", + "modified": "2014-09-01 12:05:46.834513", "modified_by": "Administrator", "module": "Stock", "name": "Landed Cost Voucher", diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_records.json b/erpnext/stock/doctype/landed_cost_voucher/test_records.json new file mode 100644 index 0000000000..4fc0017939 --- /dev/null +++ b/erpnext/stock/doctype/landed_cost_voucher/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Landed Cost Voucher", + "name": "_Test Landed Cost Voucher 1" + } +] diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 8b32211177..40a980debb 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -74,7 +74,7 @@ class StockReconciliation(StockController): self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system"))) # if both not specified - if row[2] == "" and row[3] == "": + if row[2] in ["", None] and row[3] in ["", None]: self.validation_messages.append(_get_msg(row_num, _("Please specify either Quantity or Valuation Rate or both"))) @@ -149,13 +149,13 @@ class StockReconciliation(StockController): }) # check valuation rate mandatory - if row.qty != "" and not row.valuation_rate and \ + if row.qty not in ["", None] and not row.valuation_rate and \ flt(previous_sle.get("qty_after_transaction")) <= 0: frappe.throw(_("Valuation Rate required for Item {0}").format(row.item_code)) change_in_qty = row.qty not in ["", None] and \ (flt(row.qty) - flt(previous_sle.get("qty_after_transaction"))) - + change_in_rate = row.valuation_rate not in ["", None] and \ (flt(row.valuation_rate) - flt(previous_sle.get("valuation_rate"))) @@ -171,7 +171,7 @@ class StockReconciliation(StockController): if previous_valuation_rate == 0: return flt(valuation_rate) else: - if valuation_rate == "": + if valuation_rate in ["", None]: valuation_rate = previous_valuation_rate return (qty * valuation_rate - previous_qty * previous_valuation_rate) \ / flt(qty - previous_qty) @@ -179,8 +179,7 @@ class StockReconciliation(StockController): if change_in_qty: # if change in qty, irrespective of change in rate incoming_rate = _get_incoming_rate(flt(row.qty), flt(row.valuation_rate), - flt(previous_sle.get("qty_after_transaction")), - flt(previous_sle.get("valuation_rate"))) + flt(previous_sle.get("qty_after_transaction")), flt(previous_sle.get("valuation_rate"))) row["voucher_detail_no"] = "Row: " + cstr(row.row_num) + "/Actual Entry" self.insert_entries({"actual_qty": change_in_qty, "incoming_rate": incoming_rate}, row) @@ -211,7 +210,7 @@ class StockReconciliation(StockController): def _insert_entries(): if previous_stock_queue != [[row.qty, row.valuation_rate]]: # make entry as per attachment - if row.qty: + if flt(row.qty): row["voucher_detail_no"] = "Row: " + cstr(row.row_num) + "/Actual Entry" self.insert_entries({"actual_qty": row.qty, "incoming_rate": flt(row.valuation_rate)}, row) @@ -225,7 +224,7 @@ class StockReconciliation(StockController): if change_in_qty: - if row.valuation_rate == "": + if row.valuation_rate in ["", None]: # dont want change in valuation if previous_stock_qty > 0: # set valuation_rate as previous valuation_rate diff --git a/erpnext/utilities/repost_stock.py b/erpnext/utilities/repost_stock.py index 1e1d5d95e5..4c145487d8 100644 --- a/erpnext/utilities/repost_stock.py +++ b/erpnext/utilities/repost_stock.py @@ -22,7 +22,7 @@ def repost(allow_negative_stock=False): (select item_code, warehouse from tabBin union select item_code, warehouse from `tabStock Ledger Entry`) a"""): - repost_stock(d[0], d[1], allow_negative_stock) + repost_stock(d[0], d[1]) if allow_negative_stock: frappe.db.set_default("allow_negative_stock", @@ -33,7 +33,7 @@ def repost_stock(item_code, warehouse): repost_actual_qty(item_code, warehouse) if item_code and warehouse: - update_bin(item_code, warehouse, { + update_bin_qty(item_code, warehouse, { "reserved_qty": get_reserved_qty(item_code, warehouse), "indented_qty": get_indented_qty(item_code, warehouse), "ordered_qty": get_ordered_qty(item_code, warehouse), @@ -116,7 +116,7 @@ def get_planned_qty(item_code, warehouse): return flt(planned_qty[0][0]) if planned_qty else 0 -def update_bin(item_code, warehouse, qty_dict=None): +def update_bin_qty(item_code, warehouse, qty_dict=None): from erpnext.stock.utils import get_bin bin = get_bin(item_code, warehouse) mismatch = False @@ -201,11 +201,11 @@ def reset_serial_no_status_and_warehouse(serial_nos=None): last_sle = sr.get_last_sle() if flt(last_sle.actual_qty) > 0: sr.warehouse = last_sle.warehouse - + sr.via_stock_ledger = True sr.save() except: pass - + frappe.db.sql("""update `tabSerial No` set warehouse='' where status in ('Delivered', 'Purchase Returned')""") - +