Payroll Period - fields refactor
This commit is contained in:
parent
2ee211ad21
commit
cf414cc499
@ -84,10 +84,8 @@ def create_payroll_period():
|
|||||||
doctype = 'Payroll Period',
|
doctype = 'Payroll Period',
|
||||||
name = "_Test Payroll Period",
|
name = "_Test Payroll Period",
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
periods = [
|
start_date = date(date.today().year, 1, 1),
|
||||||
dict(start_date = date(date.today().year, 1, 1),
|
end_date = date(date.today().year, 12, 31)
|
||||||
end_date = date(date.today().year, 12, 31))
|
|
||||||
]
|
|
||||||
)).insert()
|
)).insert()
|
||||||
|
|
||||||
def create_exemption_category():
|
def create_exemption_category():
|
||||||
|
@ -45,6 +45,129 @@
|
|||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "column_break_2",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "start_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Start Date",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 1,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "end_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "End Date",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 1,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "section_break_5",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"hidden": 1,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Payroll Periods",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -71,7 +194,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
@ -88,7 +211,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-04-13 19:38:28.013664",
|
"modified": "2018-05-22 14:15:59.968204",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Payroll Period",
|
"name": "Payroll Period",
|
||||||
|
@ -12,13 +12,10 @@ class PayrollPeriod(Document):
|
|||||||
|
|
||||||
def get_payroll_period_days(start_date, end_date, company):
|
def get_payroll_period_days(start_date, end_date, company):
|
||||||
payroll_period_dates = frappe.db.sql("""
|
payroll_period_dates = frappe.db.sql("""
|
||||||
select ppd.start_date, ppd.end_date from `tabPayroll Period Date` ppd, `tabPayroll Period` pp
|
select start_date, end_date from `tabPayroll Period`
|
||||||
where pp.company=%(company)s
|
where company=%(company)s
|
||||||
and ppd.parent = pp.name
|
|
||||||
and (
|
and (
|
||||||
(%(start_date)s between ppd.start_date and ppd.end_date)
|
start_date between %(start_date)s and %(end_date)s
|
||||||
or (%(end_date)s between ppd.start_date and ppd.end_date)
|
|
||||||
or (ppd.start_date between %(start_date)s and %(end_date)s)
|
|
||||||
)""", {
|
)""", {
|
||||||
'company': company,
|
'company': company,
|
||||||
'start_date': start_date,
|
'start_date': start_date,
|
||||||
|
@ -236,8 +236,7 @@ def get_leave_period(from_date, to_date, company):
|
|||||||
return leave_period
|
return leave_period
|
||||||
|
|
||||||
def get_payroll_period(from_date, to_date, company):
|
def get_payroll_period(from_date, to_date, company):
|
||||||
payroll_period = frappe.db.sql("""select pp.name, pd.start_date, pd.end_date from
|
payroll_period = frappe.db.sql("""select name, start_date, end_date from
|
||||||
`tabPayroll Period Date` pd join `tabPayroll Period` pp on
|
`tabPayroll Period`
|
||||||
pd.parent=pp.name where pd.start_date<=%s and pd.end_date>= %s
|
where start_date<=%s and end_date>= %s and company=%s""", (from_date, to_date, company), as_dict=1)
|
||||||
and pp.company=%s""", (from_date, to_date, company), as_dict=1)
|
|
||||||
return payroll_period[0] if payroll_period else None
|
return payroll_period[0] if payroll_period else None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user