-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add Salary Slip creation from Timesheet
- added `doctype_js` hook and script to show salary slip button in Timesheet - Added `PayrollTimesheet` class to override Timesheet for Payslip status - `make_salary_slip` renamed to `make_salary_slip_from_timesheet` and moved to `salary_slip.py` - test salary slip creation from Timesheet
- Loading branch information
1 parent
881c332
commit 5956f2d
Showing
8 changed files
with
137 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors | ||
# License: GNU General Public License v3. See license.txt | ||
|
||
from erpnext.projects.doctype.timesheet.timesheet import Timesheet | ||
|
||
|
||
class PayrollTimesheet(Timesheet): | ||
def set_status(self): | ||
self.status = {"0": "Draft", "1": "Submitted", "2": "Cancelled"}[str(self.docstatus or 0)] | ||
|
||
if self.per_billed == 100: | ||
self.status = "Billed" | ||
|
||
if self.salary_slip: | ||
self.status = "Payslip" | ||
|
||
if self.sales_invoice and self.salary_slip: | ||
self.status = "Completed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
frappe.ui.form.on("Timesheet", { | ||
refresh(frm) { | ||
if (frm.doc.docstatus == 1) { | ||
if (!frm.doc.salary_slip && frm.doc.employee) { | ||
frm.add_custom_button(__("Create Salary Slip"), function() { | ||
frm.trigger("make_salary_slip"); | ||
}); | ||
} | ||
} | ||
}, | ||
|
||
make_salary_slip: function(frm) { | ||
frappe.model.open_mapped_doc({ | ||
method: "hrms.payroll.doctype.salary_slip.salary_slip.make_salary_slip_from_timesheet", | ||
frm: frm | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters