diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py index 12f8335b4d..da69bccd59 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.py +++ b/erpnext/hr/doctype/salary_structure/salary_structure.py @@ -33,7 +33,7 @@ class SalaryStructure(Document): for employee in self.get('employees'): joining_date, relieving_date = frappe.db.get_value("Employee", employee.employee, ["date_of_joining", "relieving_date"]) - if employee.from_date and getdate(employee.from_date) < joining_date: + if employee.from_date and joining_date and getdate(employee.from_date) < joining_date: frappe.throw(_("From Date {0} for Employee {1} cannot be before employee's joining Date {2}") .format(employee.from_date, employee.employee, joining_date)) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 66ab6aceb6..35760fd7a1 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -74,7 +74,10 @@ def get_item_details(args): out.update(get_pricing_rule_for_item(args)) - if args.get("doctype") in ("Sales Invoice", "Delivery Note") and out.stock_qty > 0: + if (args.get("doctype") == "Delivery Note" or + (args.get("doctype") == "Sales Invoice" and args.get('update_stock'))) \ + and out.warehouse and out.stock_qty > 0: + if out.has_serial_no: out.serial_no = get_serial_no(out)