Merge pull request #4742 from nabinhait/multifixes1
Multi fixes
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index d6d8822..b60561c 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -52,6 +52,8 @@
frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx))
if d.clearance_date or self.include_reconciled_entries:
+ if not d.clearance_date:
+ d.clearance_date = None
frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", d.clearance_date)
frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s
where name=%s""", (d.clearance_date, nowdate(), d.voucher_id))
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 3c90fe2..6f6734e 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -16,9 +16,9 @@
source = gross_profit_data.grouped_data if filters.get("group_by") != "Invoice" else gross_profit_data.data
group_wise_columns = frappe._dict({
- "invoice": ["parent", "customer", "posting_date", "posting_time", "item_code", "item_name", "brand", "description", \
+ "invoice": ["parent", "customer", "posting_date","item_code", "item_name","item_group", "brand", "description", \
"warehouse", "qty", "base_rate", "buying_rate", "base_amount",
- "buying_amount", "gross_profit", "gross_profit_percent", "project"],
+ "buying_amount", "gross_profit", "gross_profit_percent", "project_name"],
"item_code": ["item_code", "item_name", "brand", "description", "warehouse", "qty", "base_rate",
"buying_rate", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"],
"warehouse": ["warehouse", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount",
@@ -35,7 +35,7 @@
"gross_profit", "gross_profit_percent"],
"sales_person": ["sales_person", "allocated_amount", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount",
"gross_profit", "gross_profit_percent"],
- "project": ["project", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"],
+ "project": ["project_name", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"],
"territory": ["territory", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"]
})
@@ -59,7 +59,7 @@
"posting_time": _("Posting Time"),
"item_code": _("Item Code") + ":Link/Item",
"item_name": _("Item Name"),
- "item_group": _("Item Group") + ":Link/Item",
+ "item_group": _("Item Group") + ":Link/Item Group",
"brand": _("Brand"),
"description": _("Description"),
"warehouse": _("Warehouse") + ":Link/Warehouse",
@@ -70,7 +70,7 @@
"buying_amount": _("Buying Amount") + ":Currency/currency",
"gross_profit": _("Gross Profit") + ":Currency/currency",
"gross_profit_percent": _("Gross Profit %") + ":Percent",
- "project": _("Project") + ":Link/Project",
+ "project_name": _("Project") + ":Link/Project",
"sales_person": _("Sales person"),
"allocated_amount": _("Allocated Amount") + ":Currency/currency",
"customer": _("Customer") + ":Link/Customer",
diff --git a/erpnext/docs/user/manual/en/manufacturing/production-order.md b/erpnext/docs/user/manual/en/manufacturing/production-order.md
index 5ded4f9..1720db9 100644
--- a/erpnext/docs/user/manual/en/manufacturing/production-order.md
+++ b/erpnext/docs/user/manual/en/manufacturing/production-order.md
@@ -28,7 +28,7 @@
<img class="screenshot" alt="PO Opeartions" src="{{docs_base_url}}/assets/img/manufacturing/PO-operations.png">
-* If you wish to reassign the wrokstation for a particular opeeration in the Production Order, you can do so before submitting the Production Order.
+* If you wish to reassign the workstation for a particular opeeration in the Production Order, you can do so before submitting the Production Order.
<img class="screenshot" alt="PO reassigning Operations" src="{{docs_base_url}}/assets/img/manufacturing/PO-reassigning-operations.png">
@@ -101,6 +101,4 @@
> Note : In order to make a Production Order against an Item you must specify 'Yes' to "Allow Production Order" on the Item form.
-> Note : In order to make a Production Order against an Item you must specify 'Yes' to "Allow Production Order" on the Item form.
-
{next}
diff --git a/erpnext/docs/user/manual/en/setting-up/articles/overwriting-data-from-data-import-tool.md b/erpnext/docs/user/manual/en/setting-up/articles/overwriting-data-from-data-import-tool.md
index b3c72b8..dafac3b 100644
--- a/erpnext/docs/user/manual/en/setting-up/articles/overwriting-data-from-data-import-tool.md
+++ b/erpnext/docs/user/manual/en/setting-up/articles/overwriting-data-from-data-import-tool.md
@@ -34,7 +34,7 @@
####Step 3: Browse Template
-After updating Item Groups in spreadheet, come back to Data Import Tool in ERPNext. Browser and select the File/template which has data to be overwritten.
+After updating Item Groups in spreadheet, come back to Data Import Tool in ERPNext. Browse and select the File/template which has data to be overwritten.
<img alt="Browse template" class="screenshot" src="{{docs_base_url}}/assets/img/articles/overwrite-3.gif">
@@ -46,4 +46,4 @@
If validation of values fails, then it will indicate row no. of spreadsheet for which validation failed and needs correction. In that case, you should corrected value in that row of spreadsheet, and then import same file again. If validation fails even for one row, none of the records are imported/overwritten.
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md b/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
index 363926e..0cf5fdc 100644
--- a/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
+++ b/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
@@ -16,8 +16,8 @@
#### **Step 3: Save Website Settings Form.**
-After setting up Home Page Press 'Save' button from website settings page and refresh the system from Help menu.Like this you can set any standard page as your default website home page. When some one visited to your website, he/she will see home page as default landing page on your website.
+After setting up Home Page Press 'Save' button from website settings page and refresh the system from Help menu. Like this you can set any standard page as your default website home page. When some one visited to your website, he/she will see home page as default landing page on your website.

-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/website/blogger.md b/erpnext/docs/user/manual/en/website/blogger.md
index cb39f80..5a5bd81 100644
--- a/erpnext/docs/user/manual/en/website/blogger.md
+++ b/erpnext/docs/user/manual/en/website/blogger.md
@@ -1,6 +1,6 @@
Blogger is a user who can post blogs.
-You can mention a shori bio about the blogger and also set a avatar here.
+You can mention a short bio about the blogger and also set a avatar here.
<img class="screenshot" alt="Blogger" src="{{docs_base_url}}/assets/img/website/blogger.png">
-{next}
\ No newline at end of file
+{next}
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index fe1291f..9e638cc 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -133,7 +133,7 @@
if not self.name:
self.name = "New Leave Application"
- for d in frappe.db.sql("""select name, leave_type, posting_date, from_date, to_date
+ for d in frappe.db.sql("""select name, leave_type, posting_date, from_date, to_date, total_leave_days
from `tabLeave Application`
where employee = %(employee)s and docstatus < 2 and status in ("Open", "Approved")
and to_date >= %(from_date)s and from_date <= %(to_date)s
@@ -144,12 +144,29 @@
"name": self.name
}, as_dict = 1):
- frappe.msgprint(_("Employee {0} has already applied for {1} between {2} and {3}")
- .format(self.employee, cstr(d['leave_type']),
- formatdate(d['from_date']), formatdate(d['to_date'])))
+ if d['total_leave_days']==0.5 and cint(self.half_day)==1:
+ sum_leave_days=frappe.db.sql("""select sum(total_leave_days) from `tabLeave Application`
+ where employee = %(employee)s
+ and docstatus < 2
+ and status in ("Open", "Approved")
+ and (from_date between %(from_date)s and %(to_date)s
+ or to_date between %(from_date)s and %(to_date)s
+ or %(from_date)s between from_date and to_date)
+ and name != %(name)s""", {
+ "employee": self.employee,
+ "from_date": self.from_date,
+ "to_date": self.to_date,
+ "name": self.name
+ })[0][0]
+ if sum_leave_days==1:
+ frappe.msgprint(_("Employee {0} has already applied this day").format(self.employee))
+ frappe.throw('<a href="#Form/Leave Application/{0}">{0}</a>'.format(d["name"]), OverlapError)
+ else:
+ frappe.msgprint(_("Employee {0} has already applied for {1} between {2} and {3}")
+ .format(self.employee, cstr(d['leave_type']),formatdate(d['from_date']), formatdate(d['to_date'])))
- frappe.throw("""Exising Application: <a href="#Form/Leave Application/{0}">{0}</a>"""
- .format(d["name"]), OverlapError)
+ frappe.throw("""Exising Application: <a href="#Form/Leave Application/{0}">{0}</a>""".format(d["name"]), OverlapError)
+
def validate_max_days(self):
max_days = frappe.db.get_value("Leave Type", self.leave_type, "max_days_allowed")
@@ -311,7 +328,7 @@
and h1.holiday_date between %s and %s""", (employee, from_date, to_date))[0][0]
if not tot_hol:
- tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2
+ tot_hol = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
where h1.parent = h2.name and h1.holiday_date between %s and %s
and h2.is_default = 1""", (from_date, to_date))[0][0]
diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js
index f1037ff..d9d4c8c 100644
--- a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js
+++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js
@@ -3,6 +3,19 @@
frappe.query_reports["Employee Holiday Attendance"] = {
"filters": [
-
+ {
+ "fieldname":"from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "reqd": 1,
+ "default": frappe.datetime.year_start()
+ },
+ {
+ "fieldname":"to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "reqd": 1,
+ "default": frappe.datetime.year_end()
+ }
]
}
diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py
index bb68cf3..f25fa03 100644
--- a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py
+++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py
@@ -11,7 +11,7 @@
filters = {}
columns = get_columns()
- data = get_employees()
+ data = get_employees(filters)
return columns, data
@@ -19,14 +19,17 @@
return [
_("Employee") + ":Link/Employee:120",
_("Name") + ":Data:200",
- _("Date")+ ":Date:100",
+ _("Date") + ":Date:100",
_("Status") + ":Data:70",
_("Holiday") + ":Data:200"
]
-def get_employees():
- holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"])
+def get_employees(filters):
+ holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"],
+ filters=[["holiday_date", ">=",
+ filters.from_date],
+ ["holiday_date", "<=", filters.to_date]])
holiday_names = {}
holidays_list = []
@@ -35,15 +38,15 @@
holiday_names[holiday.holiday_date] = holiday.description
if(holidays_list):
employee_list = frappe.db.sql("""select
- employee, employee_name, att_date, status
- from tabAttendance
- where
- att_date in ({0})""".format(', '.join(["%s"]*len(holidays_list))),
- holidays_list, as_list=True)
+ employee, employee_name, att_date, status
+ from tabAttendance
+ where
+ att_date in ({0})""".format(', '.join(["%s"] * len(holidays_list))),
+ holidays_list, as_list=True)
for employee_data in employee_list:
employee_data.append(holiday_names[employee_data[2]])
return employee_list
else:
- return None
\ No newline at end of file
+ return []
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index 0dc25d2..3bc355c 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -27,7 +27,7 @@
total_p = total_a = 0.0
for day in range(filters["total_days_in_month"]):
status = att_map.get(emp).get(day + 1, "Absent")
- status_map = {"Present": "P", "Absent": "A", "Half Day": "HD"}
+ status_map = {"Present": "P", "Absent": "A", "Half Day": "H"}
row.append(status_map[status])
if status == "Present":