Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 2a06423..4679a4a 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '9.2.18'
+__version__ = '9.2.19'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/asset_category/asset_category.json b/erpnext/accounts/doctype/asset_category/asset_category.json
index 74762d7..161ac78 100644
--- a/erpnext/accounts/doctype/asset_category/asset_category.json
+++ b/erpnext/accounts/doctype/asset_category/asset_category.json
@@ -59,7 +59,7 @@
"label": "Depreciation Method",
"length": 0,
"no_copy": 0,
- "options": "\nStraight Line\nDouble Declining Balance",
+ "options": "\nStraight Line\nDouble Declining Balance\nManual",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -228,7 +228,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-02-17 16:09:52.955332",
+ "modified": "2017-11-30 16:09:52.955332",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Asset Category",
@@ -284,4 +284,4 @@
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0
-}
\ No newline at end of file
+}
diff --git a/erpnext/patches/v9_2/remove_company_from_patient.py b/erpnext/patches/v9_2/remove_company_from_patient.py
index ad9c9c5..1ce3445 100644
--- a/erpnext/patches/v9_2/remove_company_from_patient.py
+++ b/erpnext/patches/v9_2/remove_company_from_patient.py
@@ -1,5 +1,6 @@
import frappe
def execute():
- if 'company' in frappe.db.get_table_columns("Patient"):
- frappe.db.sql("alter table `tabPatient` drop column company")
+ if frappe.db.exists("DocType", "Patient"):
+ if 'company' in frappe.db.get_table_columns("Patient"):
+ frappe.db.sql("alter table `tabPatient` drop column company")
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 180ccbb..647c9fa 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -230,6 +230,13 @@
# else it remains the same as that of previous entry
self.valuation_rate = new_stock_value / new_stock_qty
+ if not self.valuation_rate and sle.voucher_detail_no:
+ allow_zero_rate = self.check_if_allow_zero_valuation_rate(sle.voucher_type, sle.voucher_detail_no)
+ if not allow_zero_rate:
+ self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
+ sle.voucher_type, sle.voucher_no, self.allow_zero_rate,
+ currency=erpnext.get_company_currency(sle.company))
+
def get_moving_average_values(self, sle):
actual_qty = flt(sle.actual_qty)
new_stock_qty = flt(self.qty_after_transaction) + actual_qty
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 01a18b9..6f09144 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -126,7 +126,7 @@
def get_incoming_rate(args):
"""Get Incoming Rate based on valuation method"""
from erpnext.stock.stock_ledger import get_previous_sle
-
+
if isinstance(args, basestring):
args = json.loads(args)
@@ -141,6 +141,8 @@
return 0.0
previous_stock_queue = json.loads(previous_sle.get('stock_queue', '[]') or '[]')
in_rate = get_fifo_rate(previous_stock_queue, args.get("qty") or 0) if previous_stock_queue else 0
+ if not in_rate and not previous_stock_queue:
+ in_rate = previous_sle.get('valuation_rate') or 0
elif valuation_method == 'Moving Average':
in_rate = previous_sle.get('valuation_rate') or 0