diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 2a06423d364..4679a4a37a3 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect 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/assets/doctype/asset_category/asset_category.json b/erpnext/assets/doctype/asset_category/asset_category.json index 087b83d910c..3331d05e855 100644 --- a/erpnext/assets/doctype/asset_category/asset_category.json +++ b/erpnext/assets/doctype/asset_category/asset_category.json @@ -62,7 +62,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, @@ -312,4 +312,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 ad9c9c5fe01..1ce344501d5 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 180ccbb3e2b..647c9faf026 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -230,6 +230,13 @@ class update_entries_after(object): # 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 01a18b90a43..6f091446d9e 100644 --- a/erpnext/stock/utils.py +++ b/erpnext/stock/utils.py @@ -126,7 +126,7 @@ def update_bin(args, allow_negative_stock=False, via_landed_cost_voucher=False): 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 @@ def get_incoming_rate(args): 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