mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
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:
@@ -26,11 +26,11 @@
|
||||
"disbursed_amount",
|
||||
"column_break_11",
|
||||
"maximum_loan_amount",
|
||||
"is_term_loan",
|
||||
"repayment_method",
|
||||
"repayment_periods",
|
||||
"monthly_repayment_amount",
|
||||
"repayment_start_date",
|
||||
"is_term_loan",
|
||||
"account_info",
|
||||
"mode_of_payment",
|
||||
"payment_account",
|
||||
|
||||
@@ -13,6 +13,8 @@ from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calcul
|
||||
|
||||
class Loan(AccountsController):
|
||||
def validate(self):
|
||||
if self.applicant_type == 'Employee' and self.repay_from_salary:
|
||||
validate_employee_currency_with_company_currency(self.applicant, self.company)
|
||||
self.set_loan_amount()
|
||||
self.validate_loan_amount()
|
||||
self.set_missing_fields()
|
||||
@@ -329,5 +331,14 @@ def create_loan_security_unpledge(unpledge_map, loan, company, applicant_type, a
|
||||
|
||||
return unpledge_request
|
||||
|
||||
|
||||
|
||||
def validate_employee_currency_with_company_currency(applicant, company):
|
||||
from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency
|
||||
if not applicant:
|
||||
frappe.throw(_("Please select Applicant"))
|
||||
if not company:
|
||||
frappe.throw(_("Please select Company"))
|
||||
employee_currency = get_employee_currency(applicant)
|
||||
company_currency = erpnext.get_company_currency(company)
|
||||
if employee_currency != company_currency:
|
||||
frappe.throw(_("Loan cannot be repayed from salary for Employee {0} because salary is processed in currency {1}")
|
||||
.format(applicant, employee_currency))
|
||||
|
||||
@@ -19,6 +19,7 @@ from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpled
|
||||
from erpnext.loan_management.doctype.loan_application.loan_application import create_pledge
|
||||
from erpnext.loan_management.doctype.loan_disbursement.loan_disbursement import get_disbursal_amount
|
||||
from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calculate_amounts
|
||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
|
||||
|
||||
class TestLoan(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -44,6 +45,7 @@ class TestLoan(unittest.TestCase):
|
||||
create_loan_security_price("Test Security 2", 250, "Nos", get_datetime() , get_datetime(add_to_date(nowdate(), hours=24)))
|
||||
|
||||
self.applicant1 = make_employee("robert_loan@loan.com")
|
||||
make_salary_structure("Test Salary Structure Loan", "Monthly", employee=self.applicant1, currency='INR')
|
||||
if not frappe.db.exists("Customer", "_Test Loan Customer"):
|
||||
frappe.get_doc(get_customer_dict('_Test Loan Customer')).insert(ignore_permissions=True)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
|
||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee, make_salary_structure
|
||||
from erpnext.loan_management.doctype.loan.test_loan import create_loan_type, create_loan_accounts
|
||||
|
||||
class TestLoanApplication(unittest.TestCase):
|
||||
@@ -14,6 +14,7 @@ class TestLoanApplication(unittest.TestCase):
|
||||
create_loan_type("Home Loan", 500000, 9.2, 0, 1, 0, 'Cash', 'Payment Account - _TC', 'Loan Account - _TC',
|
||||
'Interest Income Account - _TC', 'Penalty Income Account - _TC', 'Repay Over Number of Periods', 18)
|
||||
self.applicant = make_employee("kate_loan@loan.com", "_Test Company")
|
||||
make_salary_structure("Test Salary Structure Loan", "Monthly", employee=self.applicant, currency='INR')
|
||||
self.create_loan_application()
|
||||
|
||||
def create_loan_application(self):
|
||||
@@ -29,7 +30,6 @@ class TestLoanApplication(unittest.TestCase):
|
||||
})
|
||||
loan_application.insert()
|
||||
|
||||
|
||||
def test_loan_totals(self):
|
||||
loan_application = frappe.get_doc("Loan Application", {"applicant":self.applicant})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user