feat: multi-currency payroll (#23519)
* feat: multi-currency payroll * fix: refactor and added conditions * fix: uncommented code * style: removed comments * fix: missing argument * style: styling changes * fix: test cases * Update asset_value_adjustment.py * patch: update columns * style: formating * style: formatting * fix: 1st review * fix: refactor * Revert "fix: refactor" This reverts commiteca0e17d11. reverting to previous state * Revert "fix: 1st review" This reverts commit7eac48b102. reverting before 1st review * fix: 2nd review changes * fix: test cases * fix: added call to fetch exchange rate * fix: remove unnecessary code * fix: refactor * fix: refactor patch * fix: refactor * fix: refactor * fix: clear test data * fix: slider * feat: multi-currency payroll * fix: refactor and added conditions * fix: uncommented code * style: removed comments * fix: missing argument * style: styling changes * fix: test cases * patch: update columns * Update asset_value_adjustment.py * style: formating * style: formatting * fix: 1st review * fix: refactor * Revert "fix: refactor" This reverts commiteca0e17d11. reverting to previous state * Revert "fix: 1st review" This reverts commit7eac48b102. reverting before 1st review * fix: 2nd review changes * fix: test cases * fix: added call to fetch exchange rate * fix: remove unnecessary code * fix: refactor * fix: refactor patch * fix: refactor * fix: refactor * fix: clear test data * fix: slider * feat: Added company field in leave encashment and employee benefit * refactor: Refactored multi-currency payroll patch * fix: currency column in salary register * refactor: Refactored code for making bank and return entry against employee advance * fix: minor cleanup * fix: fixed translation * fix: removed salary component type * fix: fixed sider issues * fix: translation and slider * style: formatted msg * fix: fixed slider * fix: travis * fix: refactor * fix: slider * fix: slider * fix: slider * fix: travis * fix: patch * fix: patch * fix: travis * fix: travis * fix: travis * fix: travis * fix: travis * fix: travis * fix: re-run travis * fix: rerun travis * fix: rerun travis * fix: rerun travis * fix: travis rerun * fix: increased throttle_user_limit from 60 to 100 * fix: patch * fix: patch * fix: assign payroll payable account as default payroll payable account in SSA * fix: removed debugger * fix: slider Co-authored-by: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -8,8 +8,8 @@ from frappe.utils import getdate
|
||||
from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import DuplicateAssignment
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('Payroll', 'doctype', 'salary_structure')
|
||||
frappe.reload_doc("Payroll", "doctype", "salary_structure_assignment")
|
||||
frappe.reload_doc('Payroll', 'doctype', 'Salary Structure')
|
||||
frappe.reload_doc("Payroll", "doctype", "Salary Structure Assignment")
|
||||
frappe.db.sql("""
|
||||
delete from `tabSalary Structure Assignment`
|
||||
where salary_structure in (select name from `tabSalary Structure` where is_active='No' or docstatus!=1)
|
||||
@@ -33,6 +33,13 @@ def execute():
|
||||
AND employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')
|
||||
""".format(cols), as_dict=1)
|
||||
|
||||
all_companies = frappe.db.get_all("Company", fields=["name", "default_currency"])
|
||||
for d in all_companies:
|
||||
company = d.name
|
||||
company_currency = d.default_currency
|
||||
|
||||
frappe.db.sql("""update `tabSalary Structure` set currency = %s where company=%s""", (company_currency, company))
|
||||
|
||||
for d in ss_details:
|
||||
try:
|
||||
joining_date, relieving_date = frappe.db.get_value("Employee", d.employee,
|
||||
@@ -42,6 +49,7 @@ def execute():
|
||||
from_date = joining_date
|
||||
elif relieving_date and getdate(from_date) > relieving_date:
|
||||
continue
|
||||
company_currency = frappe.db.get_value('Company', d.company, 'default_currency')
|
||||
|
||||
s = frappe.new_doc("Salary Structure Assignment")
|
||||
s.employee = d.employee
|
||||
@@ -52,6 +60,7 @@ def execute():
|
||||
s.base = d.get("base")
|
||||
s.variable = d.get("variable")
|
||||
s.company = d.company
|
||||
s.currency = company_currency
|
||||
|
||||
# to migrate the data of the old employees
|
||||
s.flags.old_employee = True
|
||||
|
||||
Reference in New Issue
Block a user