simplify Employee Payroll Register: remove total row, keep only date and company filters, hardcode AZN currency and Submitted status
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a8a01de845
commit
57f21d3cde
|
|
@ -19,21 +19,6 @@ frappe.query_reports["Employee Payroll Register"] = {
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
width: "100px",
|
width: "100px",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
fieldname: "currency",
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "Currency",
|
|
||||||
label: __("Currency"),
|
|
||||||
default: erpnext.get_currency(frappe.defaults.get_default("Company")),
|
|
||||||
width: "50px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldname: "employee",
|
|
||||||
label: __("Employee"),
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "Employee",
|
|
||||||
width: "100px",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
fieldname: "company",
|
fieldname: "company",
|
||||||
label: __("Company"),
|
label: __("Company"),
|
||||||
|
|
@ -43,41 +28,5 @@ frappe.query_reports["Employee Payroll Register"] = {
|
||||||
width: "100px",
|
width: "100px",
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
fieldname: "docstatus",
|
|
||||||
label: __("Document Status"),
|
|
||||||
fieldtype: "Select",
|
|
||||||
options: ["Draft", "Submitted", "Cancelled"],
|
|
||||||
default: "Submitted",
|
|
||||||
width: "100px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldname: "department",
|
|
||||||
label: __("Department"),
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "Department",
|
|
||||||
width: "100px",
|
|
||||||
get_query: function () {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
company: frappe.query_report.get_filter_value("company"),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldname: "designation",
|
|
||||||
label: __("Designation"),
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "Designation",
|
|
||||||
width: "100px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldname: "branch",
|
|
||||||
label: __("Branch"),
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "Branch",
|
|
||||||
width: "100px",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"add_total_row": 1,
|
"add_total_row": 0,
|
||||||
"creation": "2026-03-26 12:00:00.000000",
|
"creation": "2026-03-26 12:00:00.000000",
|
||||||
"disable_prepared_report": 0,
|
"disable_prepared_report": 0,
|
||||||
"disabled": 0,
|
"disabled": 0,
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,12 @@ def execute(filters=None):
|
||||||
if not filters:
|
if not filters:
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
currency = filters.get("currency")
|
currency = "AZN"
|
||||||
company_currency = erpnext.get_company_currency(filters.get("company"))
|
company_currency = erpnext.get_company_currency(filters.get("company"))
|
||||||
|
|
||||||
|
filters["currency"] = currency
|
||||||
|
filters["docstatus"] = "Submitted"
|
||||||
|
|
||||||
salary_slips = get_salary_slips(filters, company_currency)
|
salary_slips = get_salary_slips(filters, company_currency)
|
||||||
if not salary_slips:
|
if not salary_slips:
|
||||||
return get_columns(), []
|
return get_columns(), []
|
||||||
|
|
@ -250,21 +253,6 @@ def get_salary_slips(filters, company_currency):
|
||||||
if filters.get("company"):
|
if filters.get("company"):
|
||||||
query = query.where(salary_slip.company == filters.get("company"))
|
query = query.where(salary_slip.company == filters.get("company"))
|
||||||
|
|
||||||
if filters.get("employee"):
|
|
||||||
query = query.where(salary_slip.employee == filters.get("employee"))
|
|
||||||
|
|
||||||
if filters.get("currency") and filters.get("currency") != company_currency:
|
|
||||||
query = query.where(salary_slip.currency == filters.get("currency"))
|
|
||||||
|
|
||||||
if filters.get("department"):
|
|
||||||
query = query.where(salary_slip.department == filters["department"])
|
|
||||||
|
|
||||||
if filters.get("designation"):
|
|
||||||
query = query.where(salary_slip.designation == filters["designation"])
|
|
||||||
|
|
||||||
if filters.get("branch"):
|
|
||||||
query = query.where(salary_slip.branch == filters["branch"])
|
|
||||||
|
|
||||||
salary_slips = query.run(as_dict=1)
|
salary_slips = query.run(as_dict=1)
|
||||||
|
|
||||||
return salary_slips or []
|
return salary_slips or []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue