Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index b4cc2f1..96a6424 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '7.2.30'
+__version__ = '7.2.31'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py
index 9caac07..88a52e7 100644
--- a/erpnext/accounts/doctype/asset/asset.py
+++ b/erpnext/accounts/doctype/asset/asset.py
@@ -112,8 +112,8 @@
def set_accumulated_depreciation(self):
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
for d in self.get("schedules"):
- accumulated_depreciation += flt(d.depreciation_amount)
- d.accumulated_depreciation_amount = accumulated_depreciation
+ accumulated_depreciation += flt(d.depreciation_amount, d.precision("depreciation_amount"))
+ d.accumulated_depreciation_amount = flt(accumulated_depreciation, d.precision("accumulated_depreciation_amount"))
def get_depreciation_amount(self, depreciable_value):
if self.depreciation_method in ("Straight Line", "Manual"):
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 5f4e8c0..48b1849 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -205,6 +205,7 @@
cur_frm.cscript.update_stock = function(doc, dt, dn) {
hide_fields(doc, dt, dn);
+ this.frm.fields_dict.items.grid.toggle_reqd("item_code", doc.update_stock? true: false)
}
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 14459fa..feb0775 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -156,6 +156,12 @@
super(PurchaseInvoice, self).validate_warehouse()
+
+ def validate_item_code(self):
+ for d in self.get('items'):
+ if not d.item_code:
+ frappe.msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
+
def set_expense_account(self, for_validate=False):
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
@@ -164,6 +170,7 @@
stock_items = self.get_stock_items()
if self.update_stock:
+ self.validate_item_code()
self.validate_warehouse()
warehouse_account = get_warehouse_account()
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 1564b48..0b6e2af 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -321,6 +321,7 @@
cur_frm.cscript.update_stock = function(doc, dt, dn) {
cur_frm.cscript.hide_fields(doc, dt, dn);
+ this.frm.fields_dict.items.grid.toggle_reqd("item_code", doc.update_stock? true: false)
}
cur_frm.cscript['Make Delivery Note'] = function() {
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index b7fef75..a64464f 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -44,8 +44,8 @@
raise FiscalYearError, error_msg
return fy
-def validate_fiscal_year(date, fiscal_year, label=_("Date"), doc=None):
- years = [f[0] for f in get_fiscal_years(date, label=label)]
+def validate_fiscal_year(date, fiscal_year, label="Date", doc=None):
+ years = [f[0] for f in get_fiscal_years(date, label=_(label))]
if fiscal_year not in years:
if doc:
doc.fiscal_year = years[0]
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 47cdefc..6074cc6 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -139,7 +139,7 @@
qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
- if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && doc.update_stock)) {
+ if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
if(!item.rejected_qty && item.qty) {
item.received_qty = item.qty;
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 4e08287..f8aa7cf 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1047,5 +1047,4 @@
return method
},
-
});
\ No newline at end of file