fix(ui): better message after creating serial numbers (#18093)
fix(ui): better message after creating serial numbers
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index f542fa1..113dcad 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -400,19 +400,6 @@
return flt(allocation.total_leaves_allocated) - (flt(leaves_taken) + flt(leaves_encashed))
-def get_total_allocated_leaves(employee, leave_type, date):
- filters= {
- 'from_date': ['<=', date],
- 'to_date': ['>=', date],
- 'docstatus': 1,
- 'leave_type': leave_type,
- 'employee': employee
- }
-
- leave_allocation_records = frappe.db.get_all('Leave Allocation', filters=filters, fields=['total_leaves_allocated'])
-
- return flt(leave_allocation_records[0]['total_leaves_allocated']) if leave_allocation_records else flt(0)
-
def get_leaves_for_period(employee, leave_type, from_date, to_date, status, docname=None):
leave_applications = frappe.db.sql("""
select name, employee, leave_type, from_date, to_date, total_leave_days
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index 95cb30b..1843176 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -5,7 +5,7 @@
import frappe
from frappe import _
from erpnext.hr.doctype.leave_application.leave_application \
- import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period, get_total_allocated_leaves
+ import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period
def execute(filters=None):
@@ -35,6 +35,9 @@
allocation_records_based_on_to_date = get_leave_allocation_records(filters.to_date)
allocation_records_based_on_from_date = get_leave_allocation_records(filters.from_date)
+ if filters.to_date <= filters.from_date:
+ frappe.throw(_("From date can not be greater than than To date"))
+
active_employees = frappe.get_all("Employee",
filters = { "status": "Active", "company": filters.company},
fields = ["name", "employee_name", "department", "user_id"])
@@ -51,7 +54,8 @@
filters.from_date, filters.to_date)
# opening balance
- opening = get_total_allocated_leaves(employee.name, leave_type, filters.to_date)
+ opening = get_leave_balance_on(employee.name, leave_type, filters.from_date,
+ allocation_records_based_on_to_date.get(employee.name, frappe._dict()))
# closing balance
closing = get_leave_balance_on(employee.name, leave_type, filters.to_date,
diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js
index 047922f..ec71df3 100644
--- a/erpnext/public/js/conf.js
+++ b/erpnext/public/js/conf.js
@@ -38,7 +38,8 @@
"Item Group": "Tree/Item Group",
"Sales Person": "Tree/Sales Person",
"Account": "Tree/Account",
- "Cost Center": "Tree/Cost Center"
+ "Cost Center": "Tree/Cost Center",
+ "Department": "Tree/Department",
});
// preferred modules for breadcrumbs
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index ceb6207..464101e 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -376,10 +376,10 @@
# validate qty during submit
if d.docstatus==1 and d.s_warehouse and not allow_negative_stock and flt(d.actual_qty, d.precision("actual_qty")) < flt(d.transfer_qty, d.precision("actual_qty")):
- frappe.throw(_("Row {0}: Qty not available for {4} in warehouse {1} at posting time of the entry ({2} {3})").format(d.idx,
+ frappe.throw(_("Row {0}: Quantity not available for {4} in warehouse {1} at posting time of the entry ({2} {3})").format(d.idx,
frappe.bold(d.s_warehouse), formatdate(self.posting_date),
format_time(self.posting_time), frappe.bold(d.item_code))
- + '<br><br>' + _("Available qty is {0}, you need {1}").format(frappe.bold(d.actual_qty),
+ + '<br><br>' + _("Available quantity is {0}, you need {1}").format(frappe.bold(d.actual_qty),
frappe.bold(d.transfer_qty)),
NegativeStockError, title=_('Insufficient Stock'))
diff --git a/erpnext/stock/page/stock_balance/stock_balance.js b/erpnext/stock/page/stock_balance/stock_balance.js
index 85ea5b1..fc86989 100644
--- a/erpnext/stock/page/stock_balance/stock_balance.js
+++ b/erpnext/stock/page/stock_balance/stock_balance.js
@@ -60,7 +60,7 @@
}
});
- page.sort_selector.wrapper.css({'margin-right': '15px', 'margin-top': '4px'});
+ // page.sort_selector.wrapper.css({'margin-right': '15px', 'margin-top': '4px'});
frappe.require('assets/js/item-dashboard.min.js', function() {
page.item_dashboard = new erpnext.stock.ItemDashboard({
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 70da5b5..a810ddd 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -56,7 +56,7 @@
{"label": _("Voucher Type"), "fieldname": "voucher_type", "width": 110},
{"label": _("Voucher #"), "fieldname": "voucher_no", "fieldtype": "Dynamic Link", "options": "voucher_type", "width": 100},
{"label": _("Batch"), "fieldname": "batch_no", "fieldtype": "Link", "options": "Batch", "width": 100},
- {"label": _("Serial #"), "fieldname": "serial_no", "fieldtype": "Link", "options": "Serial No", "width": 100},
+ {"label": _("Serial #"), "fieldname": "serial_no", "width": 100},
{"label": _("Project"), "fieldname": "project", "fieldtype": "Link", "options": "Project", "width": 100},
{"label": _("Company"), "fieldname": "company", "fieldtype": "Link", "options": "Company", "width": 110}
]