diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index a0ad133614b..800ae2ac128 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -960,12 +960,9 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount= party_type = set_party_type(dt) party_account = set_party_account(dt, dn, doc, party_type) - exchange_rate = 1 party_account_currency = set_party_account_currency(dt, party_account, doc) - if dt != 'Expense Claim' and party_account_currency != doc.currency: - exchange_rate = doc.get('exchange_rate', 1) payment_type = set_payment_type(dt, doc) - grand_total, outstanding_amount = set_grand_total_and_outstanding_amount(party_amount, dt, party_account_currency, doc, exchange_rate) + grand_total, outstanding_amount = set_grand_total_and_outstanding_amount(party_amount, dt, party_account_currency, doc) # bank or cash bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment"), @@ -1092,7 +1089,7 @@ def set_payment_type(dt, doc): payment_type = "Pay" return payment_type -def set_grand_total_and_outstanding_amount(party_amount, dt, party_account_currency, doc, exchange_rate): +def set_grand_total_and_outstanding_amount(party_amount, dt, party_account_currency, doc): grand_total = outstanding_amount = 0 if party_amount: grand_total = outstanding_amount = party_amount @@ -1107,8 +1104,8 @@ def set_grand_total_and_outstanding_amount(party_amount, dt, party_account_curre outstanding_amount = doc.grand_total \ - doc.total_amount_reimbursed elif dt == "Employee Advance": - grand_total = flt(doc.advance_amount) * flt(exchange_rate) - outstanding_amount = (flt(doc.advance_amount) - flt(doc.paid_amount)) * flt(exchange_rate) + grand_total = flt(doc.advance_amount) * flt(doc.exchange_rate) + outstanding_amount = (flt(doc.advance_amount) - flt(doc.paid_amount)) * flt(doc.exchange_rate) elif dt == "Fees": grand_total = doc.grand_total outstanding_amount = doc.outstanding_amount diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.js b/erpnext/hr/doctype/employee_advance/employee_advance.js index bc2f1a74a58..3aa2eeaedc6 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.js +++ b/erpnext/hr/doctype/employee_advance/employee_advance.js @@ -144,7 +144,7 @@ frappe.ui.form.on('Employee Advance', { employee: function (frm) { if (frm.doc.employee) { frm.trigger('get_pending_amount'); - frm.trigger('get_employee_currency'); + // frm.trigger('get_employee_currency'); } }, @@ -156,25 +156,27 @@ frappe.ui.form.on('Employee Advance', { "posting_date": frm.doc.posting_date }, callback: function(r) { - frm.set_value("pending_amount",r.message); + frm.set_value("pending_amount",r.message['pending_amount']); + frm.set_value('currency', r.message['employee_currency']); + frm.refresh_fields(); } }); }, - get_employee_currency: function(frm) { - frappe.call({ - method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency", - args: { - employee: frm.doc.employee, - }, - callback: function(r) { - if(r.message) { - frm.set_value('currency', r.message); - frm.refresh_fields(); - } - } - }); - }, + // get_employee_currency: function(frm) { + // frappe.call({ + // method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency", + // args: { + // employee: frm.doc.employee, + // }, + // callback: function(r) { + // if(r.message) { + // frm.set_value('currency', r.message); + // frm.refresh_fields(); + // } + // } + // }); + // }, currency: function(frm) { var from_currency = frm.doc.currency; diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.py b/erpnext/hr/doctype/employee_advance/employee_advance.py index 0953610eeb9..968156baee0 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.py +++ b/erpnext/hr/doctype/employee_advance/employee_advance.py @@ -8,6 +8,7 @@ from frappe import _ from frappe.model.document import Document from frappe.utils import flt, nowdate from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account +from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency class EmployeeAdvanceOverPayment(frappe.ValidationError): pass @@ -38,41 +39,27 @@ class EmployeeAdvance(Document): self.status = "Cancelled" def set_total_advance_paid(self): - paid_amount = 0 - return_amount = 0 - - paid_amount_data = frappe.db.sql(""" - select debit_in_account_currency as paid_amount, account + paid_amount_in_company_currency = frappe.db.sql(""" + select select ifnull(sum(debit_in_company_currency), 0) as paid_amount from `tabGL Entry` where against_voucher_type = 'Employee Advance' and against_voucher = %s and party_type = 'Employee' and party = %s - """, (self.name, self.employee), as_dict=1) + """, (self.name, self.employee), as_dict=1)[0].paid_amount - return_amount_data = frappe.db.sql(""" - select credit_in_account_currency as return_amount, account + return_amount_in_company_currency = frappe.db.sql(""" + select ifnull(sum(credit_in_company_currency), 0) as return_amount from `tabGL Entry` where against_voucher_type = 'Employee Advance' and voucher_type != 'Expense Claim' and against_voucher = %s and party_type = 'Employee' and party = %s - """, (self.name, self.employee), as_dict=1) + """, (self.name, self.employee), as_dict=1)[0].return_amount - for pmd in paid_amount_data: - account_currency = frappe.db.get_value('Account', pmd.account, 'account_currency') - if account_currency != self.currency: - paid_amount += flt(pmd.paid_amount) / flt(self.exchange_rate) - else: - paid_amount += flt(pmd.paid_amount) - - for rmd in return_amount_data: - account_currency = frappe.db.get_value('Account', rmd.account, 'account_currency') - if account_currency != self.currency: - return_amount += flt(rmd.paid_amount) / flt(self.exchange_rate) - else: - return_amount += flt(rmd.paid_amount) + paid_amount = flt(paid_amount_in_company_currency) / flt(self.exchange_rate) + return_amount = flt(return_amount_in_company_currency) / flt(self.exchange_rate) if flt(paid_amount) > self.advance_amount: frappe.throw(_("Row {0}# Paid Amount cannot be greater than requested advance amount"), @@ -106,10 +93,16 @@ class EmployeeAdvance(Document): @frappe.whitelist() def get_pending_amount(employee, posting_date): + employee_curency = get_employee_currency(employee) employee_due_amount = frappe.get_all("Employee Advance", \ filters = {"employee":employee, "docstatus":1, "posting_date":("<=", posting_date)}, \ fields = ["advance_amount", "paid_amount"]) - return sum([(emp.advance_amount - emp.paid_amount) for emp in employee_due_amount]) + pending_amount = sum([(emp.advance_amount - emp.paid_amount) for emp in employee_due_amount]) + return { + 'pending_amount': pending_amount, + 'employee_currency': employee_curency + } + @frappe.whitelist() def make_bank_entry(dt, dn): diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.js b/erpnext/hr/doctype/leave_encashment/leave_encashment.js index bd3065d210f..30ba5ac4086 100644 --- a/erpnext/hr/doctype/leave_encashment/leave_encashment.js +++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.js @@ -23,7 +23,6 @@ frappe.ui.form.on('Leave Encashment', { }, employee: function(frm) { frm.trigger("get_leave_details_for_encashment"); - frm.trigger('get_employee_currency'); }, leave_type: function(frm) { frm.trigger("get_leave_details_for_encashment"); @@ -42,19 +41,4 @@ frappe.ui.form.on('Leave Encashment', { }); } }, - - get_employee_currency: function(frm) { - frappe.call({ - method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency", - args: { - employee: frm.doc.employee, - }, - callback: function(r) { - if(r.message) { - frm.set_value('currency', r.message); - frm.refresh_fields(); - } - } - }); - }, }); diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.py b/erpnext/hr/doctype/leave_encashment/leave_encashment.py index 7af313f9fa2..9cc6b83b5ed 100644 --- a/erpnext/hr/doctype/leave_encashment/leave_encashment.py +++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.py @@ -11,6 +11,7 @@ from erpnext.hr.utils import set_employee_name from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_assigned_salary_structure from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import create_leave_ledger_entry from erpnext.hr.doctype.leave_allocation.leave_allocation import get_unused_leaves +from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency class LeaveEncashment(Document): def validate(self): @@ -86,6 +87,7 @@ class LeaveEncashment(Document): self.encashment_amount = self.encashable_days * per_day_encashment if per_day_encashment > 0 else 0 self.leave_allocation = allocation.name + self.currency = get_employee_currency(self.employee) return True def get_leave_allocation(self): diff --git a/erpnext/loan_management/doctype/loan/loan.py b/erpnext/loan_management/doctype/loan/loan.py index 0b51d169a7a..c7f31c862eb 100644 --- a/erpnext/loan_management/doctype/loan/loan.py +++ b/erpnext/loan_management/doctype/loan/loan.py @@ -12,8 +12,8 @@ from erpnext.controllers.accounts_controller import AccountsController class Loan(AccountsController): def validate(self): - if self.applicant_type == 'Employee': - validate_employe_currency_with_company_currency(self.applicant, self.company) + 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() @@ -276,7 +276,7 @@ def create_loan_security_unpledge(unpledge_map, loan, company, applicant_type, a return unpledge_request -def validate_employe_currency_with_company_currency(applicant, company): +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")) @@ -285,5 +285,5 @@ def validate_employe_currency_with_company_currency(applicant, company): employee_currency = get_employee_currency(applicant) company_currency = erpnext.get_company_currency(company) if employee_currency != company_currency: - frappe.throw(_("Currency in salary structure for employee {0} should be in {1}") - .format(applicant, company_currency)) + frappe.throw(_("Loan cannot be repayed from salary for Employee {0} because salary is processed in currency {1}") + .format(applicant, employee_currency)) diff --git a/erpnext/loan_management/doctype/loan_application/loan_application.py b/erpnext/loan_management/doctype/loan_application/loan_application.py index d9fbf8a45b6..bac6e638d74 100644 --- a/erpnext/loan_management/doctype/loan_application/loan_application.py +++ b/erpnext/loan_management/doctype/loan_application/loan_application.py @@ -16,9 +16,6 @@ from six import string_types class LoanApplication(Document): def validate(self): - if self.applicant_type == 'Employee': - from erpnext.loan_management.doctype.loan.loan import validate_employe_currency_with_company_currency - validate_employe_currency_with_company_currency(self.applicant, self.company) self.set_pledge_amount() self.set_loan_amount() self.validate_loan_amount() diff --git a/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py b/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py index b5450899241..2bb6fd84e58 100644 --- a/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py +++ b/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py @@ -12,9 +12,6 @@ from erpnext.loan_management.doctype.loan_security_price.loan_security_price imp class LoanSecurityPledge(Document): def validate(self): - if self.applicant_type == 'Employee': - from erpnext.loan_management.doctype.loan.loan import validate_employe_currency_with_company_currency - validate_employe_currency_with_company_currency(self.applicant, self.company) self.set_pledge_amount() self.validate_duplicate_securities() self.validate_loan_security_type() diff --git a/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py b/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py index b5caabf413e..b3eb6001e42 100644 --- a/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py +++ b/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py @@ -13,9 +13,6 @@ from erpnext.loan_management.doctype.loan_security_price.loan_security_price imp class LoanSecurityUnpledge(Document): def validate(self): - if self.applicant_type == 'Employee': - from erpnext.loan_management.doctype.loan.loan import validate_employe_currency_with_company_currency - validate_employe_currency_with_company_currency(self.applicant, self.company) self.validate_duplicate_securities() self.validate_unpledge_qty() diff --git a/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py b/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py index b2171a1025f..74a131015b5 100644 --- a/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py +++ b/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py @@ -8,9 +8,6 @@ from frappe.model.document import Document class SanctionedLoanAmount(Document): def validate(self): - if self.applicant_type == 'Employee': - from erpnext.loan_management.doctype.loan.loan import validate_employe_currency_with_company_currency - validate_employe_currency_with_company_currency(self.applicant, self.company) sanctioned_doc = frappe.db.exists('Sanctioned Loan Amount', {'applicant': self.applicant, 'company': self.company}) if sanctioned_doc and sanctioned_doc != self.name: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fa8e2f41434..db5bda87f09 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -732,4 +732,4 @@ erpnext.patches.v13_0.set_youtube_video_id erpnext.patches.v13_0.print_uom_after_quantity_patch erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account erpnext.patches.v13_0.create_healthcare_custom_fields_in_stock_entry_detail -erpnext.patches.v13_0.updates_for_multi_currency_payroll.py \ No newline at end of file +erpnext.patches.v13_0.updates_for_multi_currency_payroll \ No newline at end of file diff --git a/erpnext/payroll/doctype/additional_salary/additional_salary.js b/erpnext/payroll/doctype/additional_salary/additional_salary.js index 4db92fa5d1b..eddad446ad9 100644 --- a/erpnext/payroll/doctype/additional_salary/additional_salary.js +++ b/erpnext/payroll/doctype/additional_salary/additional_salary.js @@ -24,40 +24,22 @@ frappe.ui.form.on('Additional Salary', { employee: function(frm) { if (frm.doc.employee) { - frm.trigger('set_company'); - frm.trigger('get_employee_currency'); + frm.trigger('get_employee_details'); } else { frm.set_value("company", null); } }, - set_company: function(frm) { + get_employee_details: function(frm) { frappe.call({ - method: "frappe.client.get_value", - args:{ - doctype: "Employee", - fieldname: "company", - filters:{ - name: frm.doc.employee - } - }, - callback: function(data) { - if(data.message){ - frm.set_value("company", data.message.company); - } - } - }); - }, - - get_employee_currency: function(frm) { - frappe.call({ - method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency", + method: "get_employee_details", args: { employee: frm.doc.employee, }, callback: function(r) { if(r.message) { - frm.set_value('currency', r.message); + frm.set_value('currency', r.message['currency']); + frm.set_value('company', r.message['company']); frm.refresh_fields(); } } diff --git a/erpnext/payroll/doctype/additional_salary/additional_salary.py b/erpnext/payroll/doctype/additional_salary/additional_salary.py index f5af677fce2..c05f021fb03 100644 --- a/erpnext/payroll/doctype/additional_salary/additional_salary.py +++ b/erpnext/payroll/doctype/additional_salary/additional_salary.py @@ -7,6 +7,7 @@ import frappe from frappe.model.document import Document from frappe import _, bold from frappe.utils import getdate, date_diff, comma_and, formatdate +from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency class AdditionalSalary(Document): @@ -89,6 +90,14 @@ class AdditionalSalary(Document): no_of_days = date_diff(getdate(end_date), getdate(start_date)) + 1 return amount_per_day * no_of_days + def get_employee_details(self, employee): + employee_currency = get_employee_currency(employee) + company = frappe.db.get_value('Employee', employee, 'company') + return { + 'currency': employee_currency, + 'company': company + } + @frappe.whitelist() def get_additional_salary_component(employee, start_date, end_date, component_type): additional_salaries = frappe.db.sql(""" diff --git a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.js b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.js index 8639995aca9..f566243268a 100644 --- a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.js +++ b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.js @@ -3,7 +3,7 @@ frappe.ui.form.on('Employee Benefit Application', { employee: function(frm) { - frm.trigger('get_employee_currency'); + // frm.trigger('get_employee_currency'); frm.trigger('set_earning_component'); var method, args; if(frm.doc.employee && frm.doc.date && frm.doc.payroll_period){ @@ -39,23 +39,6 @@ frappe.ui.form.on('Employee Benefit Application', { }); }, - get_employee_currency: function(frm) { - if (frm.doc.employee) { - frappe.call({ - method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency", - args: { - employee: frm.doc.employee, - }, - callback: function(r) { - if(r.message) { - frm.set_value('currency', r.message); - frm.refresh_fields(); - } - } - }); - } - }, - payroll_period: function(frm) { var method, args; if(frm.doc.employee && frm.doc.date && frm.doc.payroll_period){ @@ -80,7 +63,8 @@ var get_max_benefits=function(frm, method, args) { callback: function (data) { if(!data.exc){ if(data.message){ - frm.set_value("max_benefits", data.message); + frm.set_value("max_benefits", data.message['max_benefits']); + frm.set_value("currency", data.message['currency']); } else { frm.set_value("max_benefits", 0); } diff --git a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py index 90f5a37d890..b541ff6a4bd 100644 --- a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py +++ b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py @@ -106,14 +106,23 @@ class EmployeeBenefitApplication(Document): def get_max_benefits(employee, on_date): sal_struct = get_assigned_salary_structure(employee, on_date) if sal_struct: + currency = frappe.db.get_value("Salary Structure", sal_struct, "currency") max_benefits = frappe.db.get_value("Salary Structure", sal_struct, "max_benefits") if max_benefits > 0: - return max_benefits - return False + return max_benefits, currency + return{ + 'max_benefits': max_benefits, + 'currency': currency + } + return{ + 'max_benefits': False, + 'currency': False + } @frappe.whitelist() def get_max_benefits_remaining(employee, on_date, payroll_period): - max_benefits = get_max_benefits(employee, on_date) + max_benefits_and_currency = get_max_benefits(employee, on_date) + max_benefits = max_benefits_and_currency['max_benefits'] if max_benefits and max_benefits > 0: have_depends_on_payment_days = False per_day_amount_total = 0 @@ -146,8 +155,11 @@ def get_max_benefits_remaining(employee, on_date, payroll_period): leave_days_amount = leave_days * per_day_amount_total prev_sal_slip_flexi_total += leave_days_amount - return max_benefits - prev_sal_slip_flexi_total - return max_benefits + max_benefits = max_benefits - prev_sal_slip_flexi_total + return { + 'max_benefits': max_benefits, + 'currency': max_benefits_and_currency['currency'] + } def calculate_lwp(employee, start_date, holidays, working_days): lwp = 0 diff --git a/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json b/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json index 83d4ae53df8..30b0fd59b58 100644 --- a/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json +++ b/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.json @@ -14,7 +14,6 @@ "column_break_2", "payroll_period", "company", - "currency", "amended_from", "section_break_8", "declarations", @@ -93,7 +92,7 @@ "fieldname": "total_declared_amount", "fieldtype": "Currency", "label": "Total Declared Amount", - "options": "currency", + "options": "Company:company:default_currency", "read_only": 1 }, { @@ -104,22 +103,13 @@ "fieldname": "total_exemption_amount", "fieldtype": "Currency", "label": "Total Exemption Amount", - "options": "currency", + "options": "Company:company:default_currency", "read_only": 1 - }, - { - "default": "Company:company:default_currency", - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "options": "Currency", - "print_hide": 1, - "reqd": 1 } ], "is_submittable": 1, "links": [], - "modified": "2020-10-20 16:42:24.493761", + "modified": "2020-10-27 13:58:46.362277", "modified_by": "Administrator", "module": "Payroll", "name": "Employee Tax Exemption Declaration", diff --git a/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json b/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json index 723a3df3c7f..ce09090e930 100644 --- a/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json +++ b/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.json @@ -35,7 +35,7 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Maximum Exempted Amount", - "options": "currency", + "options": "Company:company:default_currency", "read_only": 1, "reqd": 1 }, @@ -44,13 +44,13 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Declared Amount", - "options": "currency", + "options": "Company:company:default_currency", "reqd": 1 } ], "istable": 1, "links": [], - "modified": "2020-10-20 16:43:09.606265", + "modified": "2020-10-27 13:56:34.214973", "modified_by": "Administrator", "module": "Payroll", "name": "Employee Tax Exemption Declaration Category", diff --git a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js index 497f35c41e3..c85974e5416 100644 --- a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js +++ b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.js @@ -55,8 +55,4 @@ frappe.ui.form.on('Employee Tax Exemption Proof Submission', { }); } }, - - currency: function(frm) { - frm.refresh_fields(); - } }); diff --git a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json index 53f18cb1fe3..4acce42aeb3 100644 --- a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json +++ b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.json @@ -11,7 +11,6 @@ "employee", "employee_name", "department", - "currency", "column_break_2", "submission_date", "payroll_period", @@ -98,7 +97,7 @@ "fieldname": "total_actual_amount", "fieldtype": "Currency", "label": "Total Actual Amount", - "options": "currency", + "options": "Company:company:default_currency", "read_only": 1 }, { @@ -109,7 +108,7 @@ "fieldname": "exemption_amount", "fieldtype": "Currency", "label": "Total Exemption Amount", - "options": "currency", + "options": "Company:company:default_currency", "read_only": 1 }, { @@ -129,20 +128,11 @@ "options": "Employee Tax Exemption Proof Submission", "print_hide": 1, "read_only": 1 - }, - { - "default": "Company:company:default_currency", - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "options": "Currency", - "print_hide": 1, - "reqd": 1 } ], "is_submittable": 1, "links": [], - "modified": "2020-10-20 16:47:03.410020", + "modified": "2020-10-27 13:59:27.146647", "modified_by": "Administrator", "module": "Payroll", "name": "Employee Tax Exemption Proof Submission", diff --git a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json index 2fd8b94efdb..b0a247eee8f 100644 --- a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json +++ b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.json @@ -34,7 +34,7 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Maximum Exemption Amount", - "options": "currency", + "options": "Company:company:default_currency", "read_only": 1, "reqd": 1 }, @@ -50,12 +50,12 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Actual Amount", - "options": "currency" + "options": "Company:company:default_currency" } ], "istable": 1, "links": [], - "modified": "2020-10-20 16:47:31.480870", + "modified": "2020-10-27 13:59:00.672996", "modified_by": "Administrator", "module": "Payroll", "name": "Employee Tax Exemption Proof Submission Detail", diff --git a/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.js b/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.js index 7d780d3b040..73a54eb8dd9 100644 --- a/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.js +++ b/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.js @@ -2,7 +2,5 @@ // For license information, please see license.txt frappe.ui.form.on('Income Tax Slab', { - currency: function(frm) { - frm.refresh_fields(); - } + }); diff --git a/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.json b/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.json index 9fa261dea2d..f8e1ceddc6d 100644 --- a/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.json +++ b/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.json @@ -9,7 +9,6 @@ "effective_from", "company", "column_break_3", - "currency", "standard_tax_exemption_amount", "allow_tax_exemption", "disabled", @@ -71,7 +70,7 @@ "fieldname": "standard_tax_exemption_amount", "fieldtype": "Currency", "label": "Standard Tax Exemption Amount", - "options": "currency" + "options": "Company:company:default_currency" }, { "fieldname": "company", @@ -91,20 +90,11 @@ "fieldtype": "Table", "label": "Other Taxes and Charges", "options": "Income Tax Slab Other Charges" - }, - { - "default": "Company:company:default_currency", - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "options": "Currency", - "print_hide": 1, - "reqd": 1 } ], "is_submittable": 1, "links": [], - "modified": "2020-10-19 13:54:24.728075", + "modified": "2020-10-27 14:01:24.574428", "modified_by": "Administrator", "module": "Payroll", "name": "Income Tax Slab", diff --git a/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.json b/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.json index 0dba3382504..ad19c93c62a 100644 --- a/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.json +++ b/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.json @@ -45,7 +45,7 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Min Taxable Income", - "options": "currency" + "options": "Company:company:default_currency" }, { "fieldname": "column_break_7", @@ -57,12 +57,12 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Max Taxable Income", - "options": "currency" + "options": "Company:company:default_currency" } ], "istable": 1, "links": [], - "modified": "2020-10-19 13:45:12.850090", + "modified": "2020-10-27 11:49:28.166087", "modified_by": "Administrator", "module": "Payroll", "name": "Income Tax Slab Other Charges", diff --git a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.js b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.js index 8fe27f87a1b..6bbe44775fd 100644 --- a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.js +++ b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.js @@ -23,8 +23,7 @@ frappe.ui.form.on('Salary Structure Assignment', { filters: { company: frm.doc.company, docstatus: 1, - disabled: 0, - currency: frm.doc.currency + disabled: 0 } }; }); diff --git a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py index 68f598b298c..e57dc7d56b2 100644 --- a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py +++ b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py @@ -46,6 +46,7 @@ def get_assigned_salary_structure(employee, on_date): @frappe.whitelist() def get_employee_currency(employee): + print(employee) employee_currency = frappe.db.get_value('Salary Structure Assignment', {'employee': employee}, 'currency') if not employee_currency: frappe.throw(_("There is no Salary Structure assigned to {0}. First assign a Salary Stucture.").format(employee)) diff --git a/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.json b/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.json index 65d3824f3aa..5e9392b0038 100644 --- a/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.json +++ b/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.json @@ -19,15 +19,13 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "From Amount", - "options": "currency", "reqd": 1 }, { "fieldname": "to_amount", "fieldtype": "Currency", "in_list_view": 1, - "label": "To Amount", - "options": "currency" + "label": "To Amount" }, { "default": "0", @@ -55,7 +53,7 @@ ], "istable": 1, "links": [], - "modified": "2020-10-19 13:44:39.549337", + "modified": "2020-10-27 11:46:00.635305", "modified_by": "Administrator", "module": "Payroll", "name": "Taxable Salary Slab", diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 9a5326e3fef..f882db60c5d 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -238,31 +238,31 @@ cur_frm.cscript.change_abbr = function() { erpnext.company.setup_queries = function(frm) { $.each([ - ["default_bank_account", {"account_type": "Bank", "account_currency": frm.doc.default_currency}], - ["default_cash_account", {"account_type": "Cash", "account_currency": frm.doc.default_currency}], - ["default_receivable_account", {"account_type": "Receivable", "account_currency": frm.doc.default_currency}], - ["default_payable_account", {"account_type": "Payable", "account_currency": frm.doc.default_currency}], - ["default_expense_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], - ["default_income_account", {"root_type": "Income", "account_currency": frm.doc.default_currency}], - ["default_payroll_payable_account", {"root_type": "Liability", "account_currency": frm.doc.default_currency}], - ["round_off_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], - ["write_off_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], - ["discount_allowed_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], - ["discount_received_account", {"root_type": "Income", "account_currency": frm.doc.default_currency}], - ["exchange_gain_loss_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], - ["unrealized_exchange_gain_loss_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], + ["default_bank_account", {"account_type": "Bank"}], + ["default_cash_account", {"account_type": "Cash"}], + ["default_receivable_account", {"account_type": "Receivable"}], + ["default_payable_account", {"account_type": "Payable"}], + ["default_expense_account", {"root_type": "Expense"}], + ["default_income_account", {"root_type": "Income"}], + ["default_payroll_payable_account", {"root_type": "Liability"}], + ["round_off_account", {"root_type": "Expense"}], + ["write_off_account", {"root_type": "Expense"}], + ["discount_allowed_account", {"root_type": "Expense"}], + ["discount_received_account", {"root_type": "Income"}], + ["exchange_gain_loss_account", {"root_type": "Expense"}], + ["unrealized_exchange_gain_loss_account", {"root_type": "Expense"}], ["accumulated_depreciation_account", - {"root_type": "Asset", "account_type": "Accumulated Depreciation", "account_currency": frm.doc.default_currency}], - ["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation", "account_currency": frm.doc.default_currency}], - ["disposal_account", {"report_type": "Profit and Loss", "account_currency": frm.doc.default_currency}], - ["default_inventory_account", {"account_type": "Stock", "account_currency": frm.doc.default_currency}], + {"root_type": "Asset", "account_type": "Accumulated Depreciation"}], + ["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation"}], + ["disposal_account", {"report_type": "Profit and Loss"}], + ["default_inventory_account", {"account_type": "Stock"}], ["cost_center", {}], ["round_off_cost_center", {}], ["depreciation_cost_center", {}], - ["default_employee_advance_account", {"root_type": "Asset", "account_currency": frm.doc.default_currency}], - ["expenses_included_in_asset_valuation", {"account_type": "Expenses Included In Asset Valuation", "account_currency": frm.doc.default_currency}], - ["capital_work_in_progress_account", {"account_type": "Capital Work in Progress", "account_currency": frm.doc.default_currency}], - ["asset_received_but_not_billed", {"account_type": "Asset Received But Not Billed", "account_currency": frm.doc.default_currency}] + ["default_employee_advance_account", {"root_type": "Asset"}], + ["expenses_included_in_asset_valuation", {"account_type": "Expenses Included In Asset Valuation"}], + ["capital_work_in_progress_account", {"account_type": "Capital Work in Progress"}], + ["asset_received_but_not_billed", {"account_type": "Asset Received But Not Billed"}] ], function(i, v) { erpnext.company.set_custom_query(frm, v); });