diff --git a/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py b/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
index 16bef56525..2162a02eff 100644
--- a/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
+++ b/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
@@ -47,21 +47,22 @@ def get_data(filters):
for d in gl_entries:
asset_data = assets_details.get(d.against_voucher)
- if not asset_data.get("accumulated_depreciation_amount"):
- asset_data.accumulated_depreciation_amount = d.debit
- else:
- asset_data.accumulated_depreciation_amount += d.debit
+ if asset_data:
+ if not asset_data.get("accumulated_depreciation_amount"):
+ asset_data.accumulated_depreciation_amount = d.debit
+ else:
+ asset_data.accumulated_depreciation_amount += d.debit
- row = frappe._dict(asset_data)
- row.update({
- "depreciation_amount": d.debit,
- "depreciation_date": d.posting_date,
- "amount_after_depreciation": (flt(row.gross_purchase_amount) -
- flt(row.accumulated_depreciation_amount)),
- "depreciation_entry": d.voucher_no
- })
+ row = frappe._dict(asset_data)
+ row.update({
+ "depreciation_amount": d.debit,
+ "depreciation_date": d.posting_date,
+ "amount_after_depreciation": (flt(row.gross_purchase_amount) -
+ flt(row.accumulated_depreciation_amount)),
+ "depreciation_entry": d.voucher_no
+ })
- data.append(row)
+ data.append(row)
return data
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 92d268f099..2fc7da8389 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -259,11 +259,16 @@ class StockEntry(StockController):
item_code.append(item.item_code)
def validate_fg_completed_qty(self):
+ item_wise_qty = {}
if self.purpose == "Manufacture" and self.work_order:
for d in self.items:
- if d.is_finished_item and d.qty != self.fg_completed_qty:
- frappe.throw(_("Finished product quantity {0} and For Quantity {1} cannot be different")
- .format(d.qty, self.fg_completed_qty))
+ if d.is_finished_item:
+ item_wise_qty.setdefault(d.item_code, []).append(d.qty)
+
+ for item_code, qty_list in iteritems(item_wise_qty):
+ if self.fg_completed_qty != sum(qty_list):
+ frappe.throw(_("The finished product {0} quantity {1} and For Quantity {2} cannot be different")
+ .format(frappe.bold(item_code), frappe.bold(sum(qty_list)), frappe.bold(self.fg_completed_qty)))
def validate_difference_account(self):
if not cint(erpnext.is_perpetual_inventory_enabled(self.company)):
@@ -319,7 +324,7 @@ class StockEntry(StockController):
if self.purpose == "Manufacture":
if validate_for_manufacture:
- if d.bom_no:
+ if d.is_finished_item or d.is_scrap_item:
d.s_warehouse = None
if not d.t_warehouse:
frappe.throw(_("Target warehouse is mandatory for row {0}").format(d.idx))
@@ -699,7 +704,7 @@ class StockEntry(StockController):
# SLE for target warehouse
self.get_sle_for_target_warehouse(sl_entries, finished_item_row)
-
+
# reverse sl entries if cancel
if self.docstatus == 2:
sl_entries.reverse()
@@ -727,9 +732,9 @@ class StockEntry(StockController):
sle.dependant_sle_voucher_detail_no = d.name
elif finished_item_row and (finished_item_row.item_code != d.item_code or finished_item_row.t_warehouse != d.s_warehouse):
sle.dependant_sle_voucher_detail_no = finished_item_row.name
-
+
sl_entries.append(sle)
-
+
def get_sle_for_target_warehouse(self, sl_entries, finished_item_row):
for d in self.get('items'):
if cstr(d.t_warehouse):
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json
index 859aea2eb6..3ff396ba77 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.json
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.json
@@ -217,7 +217,7 @@
"fieldname": "role_allowed_to_create_edit_back_dated_transactions",
"fieldtype": "Link",
"label": "Role Allowed to Create/Edit Back-dated Transactions",
- "options": "User"
+ "options": "Role"
},
{
"fieldname": "column_break_26",
@@ -234,7 +234,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2020-11-23 22:26:54.225608",
+ "modified": "2020-12-29 12:53:31.162247",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Settings",