Merge branch 'master' of github.com:webnotes/erpnext into edge
diff --git a/.gitignore b/.gitignore
index 99a0c8a..dc2ad3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*.pyc
+*.py~
*.comp.js
.DS_Store
patch.log
diff --git a/stock/doctype/valuation_control/valuation_control.py~ b/stock/doctype/valuation_control/valuation_control.py~
deleted file mode 100644
index 88ce63e..0000000
--- a/stock/doctype/valuation_control/valuation_control.py~
+++ /dev/null
@@ -1,87 +0,0 @@
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
-
- # Get FIFO Rate from Stack
- # -------------------------
- def get_fifo_rate(self, fcfs_stack, qty):
- fcfs_val = 0
- withdraw = flt(qty)
- while withdraw:
- batch = fcfs_stack[0]
- if batch[0] <= withdraw:
- # not enough or exactly same qty in current batch, clear batch
- withdraw -= batch[0]
- fcfs_val += (flt(batch[0]) * flt(batch[1]))
- fcfs_stack.pop(0)
- else:
- # all from current batch
- fcfs_val += (flt(withdraw) * flt(batch[1]))
- batch[0] -= withdraw
- withdraw = 0
- fcfs_rate = flt(fcfs_val) / flt(qty)
- return fcfs_rate
-
- # --------------------------------
- # get serializable inventory rate
- # --------------------------------
- def get_serializable_inventory_rate(self, serial_no):
- sr_nos = get_obj("Stock Ledger").get_sr_no_list(serial_no)
- tot = 0
- for s in sr_nos:
- serial_no = s.strip()
- tot += flt(webnotes.conn.get_value('Serial No', serial_no, 'purchase_rate'))
- return tot / len(sr_nos)
-
-
- # ---------------------
- # get valuation method
- # ---------------------
- def get_valuation_method(self, item_code):
- val_method = webnotes.conn.get_value('Item', item_code, 'valuation_method')
- if not val_method:
- val_method = get_defaults().get('valuation_method', 'FIFO')
- return val_method
-
-
- # Get Incoming Rate based on valuation method
- # --------------------------------------------
- def get_incoming_rate(self, posting_date, posting_time, item, warehouse, qty = 0, serial_no = ''):
- msgprint(1)
- in_rate = 0
- val_method = self.get_valuation_method(item)
- bin_obj = get_obj('Warehouse',warehouse).get_bin(item)
- if serial_no:
- in_rate = self.get_serializable_inventory_rate(serial_no)
- elif val_method == 'FIFO':
- in_rate = 0
- if qty:
- prev_sle = bin_obj.get_prev_sle(posting_date, posting_time)
- msgprint(prev_sle)
- fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]') or '[]')
- msgprint(fcfs_stack)
- in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0
- msgprint(in_rate)
- 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
- return in_rate
diff --git a/stock/page/stock_balance/stock_balance.js b/stock/page/stock_balance/stock_balance.js
index da6b831..90c7943 100644
--- a/stock/page/stock_balance/stock_balance.js
+++ b/stock/page/stock_balance/stock_balance.js
@@ -130,6 +130,12 @@
}
}
}
+
+ // opening + diff = closing
+ // adding opening, since diff already added to closing
+ $.each(me.item_by_name, function(key, item) {
+ item.closing += item.opening;
+ });
},
update_groups: function() {
diff --git a/support/report/serial_no_service_contract_expiry/__init__.py b/stock/report/serial_no_service_contract_expiry/__init__.py
similarity index 100%
rename from support/report/serial_no_service_contract_expiry/__init__.py
rename to stock/report/serial_no_service_contract_expiry/__init__.py
diff --git a/support/report/serial_no_service_contract_expiry/serial_no_service_contract_expiry.txt b/stock/report/serial_no_service_contract_expiry/serial_no_service_contract_expiry.txt
similarity index 100%
rename from support/report/serial_no_service_contract_expiry/serial_no_service_contract_expiry.txt
rename to stock/report/serial_no_service_contract_expiry/serial_no_service_contract_expiry.txt
diff --git a/support/report/serial_no_warranty_expiry/__init__.py b/stock/report/serial_no_warranty_expiry/__init__.py
similarity index 100%
rename from support/report/serial_no_warranty_expiry/__init__.py
rename to stock/report/serial_no_warranty_expiry/__init__.py
diff --git a/stock/report/serial_no_warranty_expiry/serial_no_warranty_expiry.txt b/stock/report/serial_no_warranty_expiry/serial_no_warranty_expiry.txt
new file mode 100644
index 0000000..603e988
--- /dev/null
+++ b/stock/report/serial_no_warranty_expiry/serial_no_warranty_expiry.txt
@@ -0,0 +1,19 @@
+[
+ {
+ "owner": "Administrator",
+ "docstatus": 0,
+ "creation": "2013-01-04 13:57:25",
+ "modified_by": "Administrator",
+ "modified": "2013-01-07 13:22:26"
+ },
+ {
+ "name": "__common__",
+ "ref_doctype": "Serial No",
+ "doctype": "Report",
+ "json": "{\"filters\":[[\"Serial No\",\"status\",\"=\",\"Delivered\"]],\"columns\":[[\"name\",\"Serial No\"],[\"item_code\",\"Serial No\"],[\"warranty_expiry_date\",\"Serial No\"],[\"warranty_period\",\"Serial No\"],[\"maintenance_status\",\"Serial No\"],[\"purchase_document_no\",\"Serial No\"],[\"purchase_date\",\"Serial No\"],[\"supplier\",\"Serial No\"],[\"supplier_name\",\"Serial No\"],[\"delivery_document_no\",\"Serial No\"],[\"delivery_date\",\"Serial No\"],[\"customer\",\"Serial No\"],[\"customer_name\",\"Serial No\"],[\"item_name\",\"Serial No\"],[\"description\",\"Serial No\"],[\"item_group\",\"Serial No\"],[\"brand\",\"Serial No\"]],\"sort_by\":\"Serial No.warranty_expiry_date\",\"sort_order\":\"asc\",\"sort_by_next\":\"\",\"sort_order_next\":\"asc\"}"
+ },
+ {
+ "name": "Serial No Warranty Expiry",
+ "doctype": "Report"
+ }
+]
\ No newline at end of file
diff --git a/support/report/__init__.py b/support/report/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/support/report/__init__.py
+++ /dev/null
diff --git a/support/report/serial_no_warranty_expiry/serial_no_warranty_expiry.txt b/support/report/serial_no_warranty_expiry/serial_no_warranty_expiry.txt
deleted file mode 100644
index 4b6c4be..0000000
--- a/support/report/serial_no_warranty_expiry/serial_no_warranty_expiry.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2013-01-03 17:24:01",
- "modified_by": "Administrator",
- "modified": "2013-01-03 17:35:42"
- },
- {
- "name": "__common__",
- "ref_doctype": "Serial No",
- "doctype": "Report",
- "json": "{\"filters\":[[\"Serial No\",\"status\",\"=\",\"Delivered\"]],\"columns\":[[\"name\",\"Serial No\"],[\"item_code\",\"Serial No\"],[\"warranty_expiry_date\",\"Serial No\"],[\"maintenance_status\",\"Serial No\"],[\"delivery_document_no\",\"Serial No\"],[\"customer\",\"Serial No\"],[\"customer_name\",\"Serial No\"],[\"item_name\",\"Serial No\"],[\"description\",\"Serial No\"],[\"item_group\",\"Serial No\"],[\"brand\",\"Serial No\"]],\"sort_by\":\"Serial No.warranty_expiry_date\",\"sort_order\":\"asc\",\"sort_by_next\":\"\",\"sort_order_next\":\"asc\"}"
- },
- {
- "name": "Serial No Warranty Expiry",
- "doctype": "Report"
- }
-]
\ No newline at end of file