Merge pull request #7216 from KanchanChauhan/salary-fixes
[Fixes]Payroll Fixes
This commit is contained in:
commit
42b6e37d15
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
frappe.ui.form.on("Process Payroll", {
|
frappe.ui.form.on("Process Payroll", {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.doc.posting_date = frm.doc.start_date = frm.doc.end_date = frappe.datetime.nowdate()
|
frm.doc.posting_date = frappe.datetime.nowdate()
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "Today",
|
"default": "",
|
||||||
"fieldname": "posting_date",
|
"fieldname": "posting_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -352,7 +352,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "Today",
|
"default": "",
|
||||||
"fieldname": "start_date",
|
"fieldname": "start_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -408,7 +408,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "Today",
|
"default": "",
|
||||||
"fieldname": "end_date",
|
"fieldname": "end_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -722,7 +722,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-11-26 01:14:51.691057",
|
"modified": "2016-12-14 12:58:16.206040",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Process Payroll",
|
"name": "Process Payroll",
|
||||||
|
@ -5,9 +5,6 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import cint, flt, nowdate, add_days, getdate
|
from frappe.utils import cint, flt, nowdate, add_days, getdate
|
||||||
from frappe import _
|
from frappe import _
|
||||||
import collections
|
|
||||||
from collections import defaultdict
|
|
||||||
from calendar import monthrange
|
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
@ -30,8 +27,9 @@ class ProcessPayroll(Document):
|
|||||||
sal_struct = frappe.db.sql("""
|
sal_struct = frappe.db.sql("""
|
||||||
select name from `tabSalary Structure`
|
select name from `tabSalary Structure`
|
||||||
where docstatus != 2 and is_active = 'Yes' and company = %(company)s and
|
where docstatus != 2 and is_active = 'Yes' and company = %(company)s and
|
||||||
ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s""",
|
from_date <= %(start_date)s and (to_date is null or to_date >= %(end_date)s) and
|
||||||
{"company": self.company, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
|
ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s {struct_cond}""".format(struct_cond=struct_cond),
|
||||||
|
{"company": self.company, "start_date": self.start_date, "end_date": self.end_date, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
|
||||||
|
|
||||||
if sal_struct:
|
if sal_struct:
|
||||||
cond += "and t2.parent IN %(sal_struct)s "
|
cond += "and t2.parent IN %(sal_struct)s "
|
||||||
@ -314,7 +312,9 @@ def get_month_details(year, month):
|
|||||||
frappe.throw(_("Fiscal Year {0} not found").format(year))
|
frappe.throw(_("Fiscal Year {0} not found").format(year))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_start_end_dates(payroll_frequency, start_date, end_date):
|
def get_start_end_dates(payroll_frequency = None, start_date = None, end_date = None):
|
||||||
|
if payroll_frequency and not start_date:
|
||||||
|
start_date = nowdate()
|
||||||
if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly":
|
if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly":
|
||||||
fiscal_year = get_fiscal_year(start_date)[0] or get_fiscal_year(end_date)[0]
|
fiscal_year = get_fiscal_year(start_date)[0] or get_fiscal_year(end_date)[0]
|
||||||
month = "%02d" % getdate(start_date).month or "%02d" % getdate(end_date).month
|
month = "%02d" % getdate(start_date).month or "%02d" % getdate(end_date).month
|
||||||
|
@ -408,7 +408,7 @@
|
|||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 1,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -421,7 +421,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "Today",
|
"default": "",
|
||||||
"fieldname": "start_date",
|
"fieldname": "start_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -450,7 +450,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "Today",
|
"default": "",
|
||||||
"depends_on": "",
|
"depends_on": "",
|
||||||
"fieldname": "end_date",
|
"fieldname": "end_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
@ -1361,7 +1361,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-12-08 12:03:31.602913",
|
"modified": "2016-12-14 12:48:44.038588",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Salary Slip",
|
"name": "Salary Slip",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user