fix: 1st review

This commit is contained in:
Afshan
2020-10-27 14:15:42 +05:30
parent 7e256f804a
commit 7eac48b102
27 changed files with 123 additions and 208 deletions

View File

@@ -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_type = set_party_type(dt)
party_account = set_party_account(dt, dn, doc, party_type) party_account = set_party_account(dt, dn, doc, party_type)
exchange_rate = 1
party_account_currency = set_party_account_currency(dt, party_account, doc) 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) 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 or cash
bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment"), 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" payment_type = "Pay"
return payment_type 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 grand_total = outstanding_amount = 0
if party_amount: if party_amount:
grand_total = outstanding_amount = 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 \ outstanding_amount = doc.grand_total \
- doc.total_amount_reimbursed - doc.total_amount_reimbursed
elif dt == "Employee Advance": elif dt == "Employee Advance":
grand_total = flt(doc.advance_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(exchange_rate) outstanding_amount = (flt(doc.advance_amount) - flt(doc.paid_amount)) * flt(doc.exchange_rate)
elif dt == "Fees": elif dt == "Fees":
grand_total = doc.grand_total grand_total = doc.grand_total
outstanding_amount = doc.outstanding_amount outstanding_amount = doc.outstanding_amount

View File

@@ -144,7 +144,7 @@ frappe.ui.form.on('Employee Advance', {
employee: function (frm) { employee: function (frm) {
if (frm.doc.employee) { if (frm.doc.employee) {
frm.trigger('get_pending_amount'); 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 "posting_date": frm.doc.posting_date
}, },
callback: function(r) { 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) { // get_employee_currency: function(frm) {
frappe.call({ // frappe.call({
method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency", // method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency",
args: { // args: {
employee: frm.doc.employee, // employee: frm.doc.employee,
}, // },
callback: function(r) { // callback: function(r) {
if(r.message) { // if(r.message) {
frm.set_value('currency', r.message); // frm.set_value('currency', r.message);
frm.refresh_fields(); // frm.refresh_fields();
} // }
} // }
}); // });
}, // },
currency: function(frm) { currency: function(frm) {
var from_currency = frm.doc.currency; var from_currency = frm.doc.currency;

View File

@@ -8,6 +8,7 @@ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import flt, nowdate from frappe.utils import flt, nowdate
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account 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): class EmployeeAdvanceOverPayment(frappe.ValidationError):
pass pass
@@ -38,41 +39,27 @@ class EmployeeAdvance(Document):
self.status = "Cancelled" self.status = "Cancelled"
def set_total_advance_paid(self): def set_total_advance_paid(self):
paid_amount = 0 paid_amount_in_company_currency = frappe.db.sql("""
return_amount = 0 select select ifnull(sum(debit_in_company_currency), 0) as paid_amount
paid_amount_data = frappe.db.sql("""
select debit_in_account_currency as paid_amount, account
from `tabGL Entry` from `tabGL Entry`
where against_voucher_type = 'Employee Advance' where against_voucher_type = 'Employee Advance'
and against_voucher = %s and against_voucher = %s
and party_type = 'Employee' and party_type = 'Employee'
and party = %s 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(""" return_amount_in_company_currency = frappe.db.sql("""
select credit_in_account_currency as return_amount, account select ifnull(sum(credit_in_company_currency), 0) as return_amount
from `tabGL Entry` from `tabGL Entry`
where against_voucher_type = 'Employee Advance' where against_voucher_type = 'Employee Advance'
and voucher_type != 'Expense Claim' and voucher_type != 'Expense Claim'
and against_voucher = %s and against_voucher = %s
and party_type = 'Employee' and party_type = 'Employee'
and party = %s 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: paid_amount = flt(paid_amount_in_company_currency) / flt(self.exchange_rate)
account_currency = frappe.db.get_value('Account', pmd.account, 'account_currency') return_amount = flt(return_amount_in_company_currency) / flt(self.exchange_rate)
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)
if flt(paid_amount) > self.advance_amount: if flt(paid_amount) > self.advance_amount:
frappe.throw(_("Row {0}# Paid Amount cannot be greater than requested advance amount"), frappe.throw(_("Row {0}# Paid Amount cannot be greater than requested advance amount"),
@@ -106,10 +93,16 @@ class EmployeeAdvance(Document):
@frappe.whitelist() @frappe.whitelist()
def get_pending_amount(employee, posting_date): def get_pending_amount(employee, posting_date):
employee_curency = get_employee_currency(employee)
employee_due_amount = frappe.get_all("Employee Advance", \ employee_due_amount = frappe.get_all("Employee Advance", \
filters = {"employee":employee, "docstatus":1, "posting_date":("<=", posting_date)}, \ filters = {"employee":employee, "docstatus":1, "posting_date":("<=", posting_date)}, \
fields = ["advance_amount", "paid_amount"]) 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() @frappe.whitelist()
def make_bank_entry(dt, dn): def make_bank_entry(dt, dn):

View File

@@ -23,7 +23,6 @@ frappe.ui.form.on('Leave Encashment', {
}, },
employee: function(frm) { employee: function(frm) {
frm.trigger("get_leave_details_for_encashment"); frm.trigger("get_leave_details_for_encashment");
frm.trigger('get_employee_currency');
}, },
leave_type: function(frm) { leave_type: function(frm) {
frm.trigger("get_leave_details_for_encashment"); 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();
}
}
});
},
}); });

View File

@@ -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.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_ledger_entry.leave_ledger_entry import create_leave_ledger_entry
from erpnext.hr.doctype.leave_allocation.leave_allocation import get_unused_leaves 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): class LeaveEncashment(Document):
def validate(self): 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.encashment_amount = self.encashable_days * per_day_encashment if per_day_encashment > 0 else 0
self.leave_allocation = allocation.name self.leave_allocation = allocation.name
self.currency = get_employee_currency(self.employee)
return True return True
def get_leave_allocation(self): def get_leave_allocation(self):

View File

@@ -12,8 +12,8 @@ from erpnext.controllers.accounts_controller import AccountsController
class Loan(AccountsController): class Loan(AccountsController):
def validate(self): def validate(self):
if self.applicant_type == 'Employee': if self.applicant_type == 'Employee' and self.repay_from_salary:
validate_employe_currency_with_company_currency(self.applicant, self.company) validate_employee_currency_with_company_currency(self.applicant, self.company)
self.set_loan_amount() self.set_loan_amount()
self.validate_loan_amount() self.validate_loan_amount()
self.set_missing_fields() self.set_missing_fields()
@@ -276,7 +276,7 @@ def create_loan_security_unpledge(unpledge_map, loan, company, applicant_type, a
return unpledge_request 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 from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency
if not applicant: if not applicant:
frappe.throw(_("Please select 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) employee_currency = get_employee_currency(applicant)
company_currency = erpnext.get_company_currency(company) company_currency = erpnext.get_company_currency(company)
if employee_currency != company_currency: if employee_currency != company_currency:
frappe.throw(_("Currency in salary structure for employee {0} should be in {1}") frappe.throw(_("Loan cannot be repayed from salary for Employee {0} because salary is processed in currency {1}")
.format(applicant, company_currency)) .format(applicant, employee_currency))

View File

@@ -16,9 +16,6 @@ from six import string_types
class LoanApplication(Document): class LoanApplication(Document):
def validate(self): 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_pledge_amount()
self.set_loan_amount() self.set_loan_amount()
self.validate_loan_amount() self.validate_loan_amount()

View File

@@ -12,9 +12,6 @@ from erpnext.loan_management.doctype.loan_security_price.loan_security_price imp
class LoanSecurityPledge(Document): class LoanSecurityPledge(Document):
def validate(self): 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_pledge_amount()
self.validate_duplicate_securities() self.validate_duplicate_securities()
self.validate_loan_security_type() self.validate_loan_security_type()

View File

@@ -13,9 +13,6 @@ from erpnext.loan_management.doctype.loan_security_price.loan_security_price imp
class LoanSecurityUnpledge(Document): class LoanSecurityUnpledge(Document):
def validate(self): 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_duplicate_securities()
self.validate_unpledge_qty() self.validate_unpledge_qty()

View File

@@ -8,9 +8,6 @@ from frappe.model.document import Document
class SanctionedLoanAmount(Document): class SanctionedLoanAmount(Document):
def validate(self): 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}) sanctioned_doc = frappe.db.exists('Sanctioned Loan Amount', {'applicant': self.applicant, 'company': self.company})
if sanctioned_doc and sanctioned_doc != self.name: if sanctioned_doc and sanctioned_doc != self.name:

View File

@@ -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.print_uom_after_quantity_patch
erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account 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.create_healthcare_custom_fields_in_stock_entry_detail
erpnext.patches.v13_0.updates_for_multi_currency_payroll.py erpnext.patches.v13_0.updates_for_multi_currency_payroll

View File

@@ -24,40 +24,22 @@ frappe.ui.form.on('Additional Salary', {
employee: function(frm) { employee: function(frm) {
if (frm.doc.employee) { if (frm.doc.employee) {
frm.trigger('set_company'); frm.trigger('get_employee_details');
frm.trigger('get_employee_currency');
} else { } else {
frm.set_value("company", null); frm.set_value("company", null);
} }
}, },
set_company: function(frm) { get_employee_details: function(frm) {
frappe.call({ frappe.call({
method: "frappe.client.get_value", method: "get_employee_details",
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",
args: { args: {
employee: frm.doc.employee, employee: frm.doc.employee,
}, },
callback: function(r) { callback: function(r) {
if(r.message) { 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(); frm.refresh_fields();
} }
} }

View File

@@ -7,6 +7,7 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
from frappe import _, bold from frappe import _, bold
from frappe.utils import getdate, date_diff, comma_and, formatdate 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): class AdditionalSalary(Document):
@@ -89,6 +90,14 @@ class AdditionalSalary(Document):
no_of_days = date_diff(getdate(end_date), getdate(start_date)) + 1 no_of_days = date_diff(getdate(end_date), getdate(start_date)) + 1
return amount_per_day * no_of_days 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() @frappe.whitelist()
def get_additional_salary_component(employee, start_date, end_date, component_type): def get_additional_salary_component(employee, start_date, end_date, component_type):
additional_salaries = frappe.db.sql(""" additional_salaries = frappe.db.sql("""

View File

@@ -3,7 +3,7 @@
frappe.ui.form.on('Employee Benefit Application', { frappe.ui.form.on('Employee Benefit Application', {
employee: function(frm) { employee: function(frm) {
frm.trigger('get_employee_currency'); // frm.trigger('get_employee_currency');
frm.trigger('set_earning_component'); frm.trigger('set_earning_component');
var method, args; var method, args;
if(frm.doc.employee && frm.doc.date && frm.doc.payroll_period){ 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) { payroll_period: function(frm) {
var method, args; var method, args;
if(frm.doc.employee && frm.doc.date && frm.doc.payroll_period){ 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) { callback: function (data) {
if(!data.exc){ if(!data.exc){
if(data.message){ 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 { } else {
frm.set_value("max_benefits", 0); frm.set_value("max_benefits", 0);
} }

View File

@@ -106,14 +106,23 @@ class EmployeeBenefitApplication(Document):
def get_max_benefits(employee, on_date): def get_max_benefits(employee, on_date):
sal_struct = get_assigned_salary_structure(employee, on_date) sal_struct = get_assigned_salary_structure(employee, on_date)
if sal_struct: 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") max_benefits = frappe.db.get_value("Salary Structure", sal_struct, "max_benefits")
if max_benefits > 0: if max_benefits > 0:
return max_benefits return max_benefits, currency
return False return{
'max_benefits': max_benefits,
'currency': currency
}
return{
'max_benefits': False,
'currency': False
}
@frappe.whitelist() @frappe.whitelist()
def get_max_benefits_remaining(employee, on_date, payroll_period): 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: if max_benefits and max_benefits > 0:
have_depends_on_payment_days = False have_depends_on_payment_days = False
per_day_amount_total = 0 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 leave_days_amount = leave_days * per_day_amount_total
prev_sal_slip_flexi_total += leave_days_amount prev_sal_slip_flexi_total += leave_days_amount
return max_benefits - prev_sal_slip_flexi_total max_benefits = max_benefits - prev_sal_slip_flexi_total
return max_benefits return {
'max_benefits': max_benefits,
'currency': max_benefits_and_currency['currency']
}
def calculate_lwp(employee, start_date, holidays, working_days): def calculate_lwp(employee, start_date, holidays, working_days):
lwp = 0 lwp = 0

View File

@@ -14,7 +14,6 @@
"column_break_2", "column_break_2",
"payroll_period", "payroll_period",
"company", "company",
"currency",
"amended_from", "amended_from",
"section_break_8", "section_break_8",
"declarations", "declarations",
@@ -93,7 +92,7 @@
"fieldname": "total_declared_amount", "fieldname": "total_declared_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Declared Amount", "label": "Total Declared Amount",
"options": "currency", "options": "Company:company:default_currency",
"read_only": 1 "read_only": 1
}, },
{ {
@@ -104,22 +103,13 @@
"fieldname": "total_exemption_amount", "fieldname": "total_exemption_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Exemption Amount", "label": "Total Exemption Amount",
"options": "currency", "options": "Company:company:default_currency",
"read_only": 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, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-10-20 16:42:24.493761", "modified": "2020-10-27 13:58:46.362277",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Employee Tax Exemption Declaration", "name": "Employee Tax Exemption Declaration",

View File

@@ -35,7 +35,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Maximum Exempted Amount", "label": "Maximum Exempted Amount",
"options": "currency", "options": "Company:company:default_currency",
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
}, },
@@ -44,13 +44,13 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Declared Amount", "label": "Declared Amount",
"options": "currency", "options": "Company:company:default_currency",
"reqd": 1 "reqd": 1
} }
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-10-20 16:43:09.606265", "modified": "2020-10-27 13:56:34.214973",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Employee Tax Exemption Declaration Category", "name": "Employee Tax Exemption Declaration Category",

View File

@@ -55,8 +55,4 @@ frappe.ui.form.on('Employee Tax Exemption Proof Submission', {
}); });
} }
}, },
currency: function(frm) {
frm.refresh_fields();
}
}); });

View File

@@ -11,7 +11,6 @@
"employee", "employee",
"employee_name", "employee_name",
"department", "department",
"currency",
"column_break_2", "column_break_2",
"submission_date", "submission_date",
"payroll_period", "payroll_period",
@@ -98,7 +97,7 @@
"fieldname": "total_actual_amount", "fieldname": "total_actual_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Actual Amount", "label": "Total Actual Amount",
"options": "currency", "options": "Company:company:default_currency",
"read_only": 1 "read_only": 1
}, },
{ {
@@ -109,7 +108,7 @@
"fieldname": "exemption_amount", "fieldname": "exemption_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Exemption Amount", "label": "Total Exemption Amount",
"options": "currency", "options": "Company:company:default_currency",
"read_only": 1 "read_only": 1
}, },
{ {
@@ -129,20 +128,11 @@
"options": "Employee Tax Exemption Proof Submission", "options": "Employee Tax Exemption Proof Submission",
"print_hide": 1, "print_hide": 1,
"read_only": 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, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-10-20 16:47:03.410020", "modified": "2020-10-27 13:59:27.146647",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Employee Tax Exemption Proof Submission", "name": "Employee Tax Exemption Proof Submission",

View File

@@ -34,7 +34,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Maximum Exemption Amount", "label": "Maximum Exemption Amount",
"options": "currency", "options": "Company:company:default_currency",
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
}, },
@@ -50,12 +50,12 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Actual Amount", "label": "Actual Amount",
"options": "currency" "options": "Company:company:default_currency"
} }
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-10-20 16:47:31.480870", "modified": "2020-10-27 13:59:00.672996",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Employee Tax Exemption Proof Submission Detail", "name": "Employee Tax Exemption Proof Submission Detail",

View File

@@ -2,7 +2,5 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Income Tax Slab', { frappe.ui.form.on('Income Tax Slab', {
currency: function(frm) {
frm.refresh_fields();
}
}); });

View File

@@ -9,7 +9,6 @@
"effective_from", "effective_from",
"company", "company",
"column_break_3", "column_break_3",
"currency",
"standard_tax_exemption_amount", "standard_tax_exemption_amount",
"allow_tax_exemption", "allow_tax_exemption",
"disabled", "disabled",
@@ -71,7 +70,7 @@
"fieldname": "standard_tax_exemption_amount", "fieldname": "standard_tax_exemption_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Standard Tax Exemption Amount", "label": "Standard Tax Exemption Amount",
"options": "currency" "options": "Company:company:default_currency"
}, },
{ {
"fieldname": "company", "fieldname": "company",
@@ -91,20 +90,11 @@
"fieldtype": "Table", "fieldtype": "Table",
"label": "Other Taxes and Charges", "label": "Other Taxes and Charges",
"options": "Income Tax Slab Other 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, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-10-19 13:54:24.728075", "modified": "2020-10-27 14:01:24.574428",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Income Tax Slab", "name": "Income Tax Slab",

View File

@@ -45,7 +45,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Min Taxable Income", "label": "Min Taxable Income",
"options": "currency" "options": "Company:company:default_currency"
}, },
{ {
"fieldname": "column_break_7", "fieldname": "column_break_7",
@@ -57,12 +57,12 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Max Taxable Income", "label": "Max Taxable Income",
"options": "currency" "options": "Company:company:default_currency"
} }
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-10-19 13:45:12.850090", "modified": "2020-10-27 11:49:28.166087",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Income Tax Slab Other Charges", "name": "Income Tax Slab Other Charges",

View File

@@ -23,8 +23,7 @@ frappe.ui.form.on('Salary Structure Assignment', {
filters: { filters: {
company: frm.doc.company, company: frm.doc.company,
docstatus: 1, docstatus: 1,
disabled: 0, disabled: 0
currency: frm.doc.currency
} }
}; };
}); });

View File

@@ -46,6 +46,7 @@ def get_assigned_salary_structure(employee, on_date):
@frappe.whitelist() @frappe.whitelist()
def get_employee_currency(employee): def get_employee_currency(employee):
print(employee)
employee_currency = frappe.db.get_value('Salary Structure Assignment', {'employee': employee}, 'currency') employee_currency = frappe.db.get_value('Salary Structure Assignment', {'employee': employee}, 'currency')
if not employee_currency: if not employee_currency:
frappe.throw(_("There is no Salary Structure assigned to {0}. First assign a Salary Stucture.").format(employee)) frappe.throw(_("There is no Salary Structure assigned to {0}. First assign a Salary Stucture.").format(employee))

View File

@@ -19,15 +19,13 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "From Amount", "label": "From Amount",
"options": "currency",
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "to_amount", "fieldname": "to_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "To Amount", "label": "To Amount"
"options": "currency"
}, },
{ {
"default": "0", "default": "0",
@@ -55,7 +53,7 @@
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-10-19 13:44:39.549337", "modified": "2020-10-27 11:46:00.635305",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Payroll", "module": "Payroll",
"name": "Taxable Salary Slab", "name": "Taxable Salary Slab",

View File

@@ -238,31 +238,31 @@ cur_frm.cscript.change_abbr = function() {
erpnext.company.setup_queries = function(frm) { erpnext.company.setup_queries = function(frm) {
$.each([ $.each([
["default_bank_account", {"account_type": "Bank", "account_currency": frm.doc.default_currency}], ["default_bank_account", {"account_type": "Bank"}],
["default_cash_account", {"account_type": "Cash", "account_currency": frm.doc.default_currency}], ["default_cash_account", {"account_type": "Cash"}],
["default_receivable_account", {"account_type": "Receivable", "account_currency": frm.doc.default_currency}], ["default_receivable_account", {"account_type": "Receivable"}],
["default_payable_account", {"account_type": "Payable", "account_currency": frm.doc.default_currency}], ["default_payable_account", {"account_type": "Payable"}],
["default_expense_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], ["default_expense_account", {"root_type": "Expense"}],
["default_income_account", {"root_type": "Income", "account_currency": frm.doc.default_currency}], ["default_income_account", {"root_type": "Income"}],
["default_payroll_payable_account", {"root_type": "Liability", "account_currency": frm.doc.default_currency}], ["default_payroll_payable_account", {"root_type": "Liability"}],
["round_off_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], ["round_off_account", {"root_type": "Expense"}],
["write_off_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], ["write_off_account", {"root_type": "Expense"}],
["discount_allowed_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], ["discount_allowed_account", {"root_type": "Expense"}],
["discount_received_account", {"root_type": "Income", "account_currency": frm.doc.default_currency}], ["discount_received_account", {"root_type": "Income"}],
["exchange_gain_loss_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], ["exchange_gain_loss_account", {"root_type": "Expense"}],
["unrealized_exchange_gain_loss_account", {"root_type": "Expense", "account_currency": frm.doc.default_currency}], ["unrealized_exchange_gain_loss_account", {"root_type": "Expense"}],
["accumulated_depreciation_account", ["accumulated_depreciation_account",
{"root_type": "Asset", "account_type": "Accumulated Depreciation", "account_currency": frm.doc.default_currency}], {"root_type": "Asset", "account_type": "Accumulated Depreciation"}],
["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation", "account_currency": frm.doc.default_currency}], ["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation"}],
["disposal_account", {"report_type": "Profit and Loss", "account_currency": frm.doc.default_currency}], ["disposal_account", {"report_type": "Profit and Loss"}],
["default_inventory_account", {"account_type": "Stock", "account_currency": frm.doc.default_currency}], ["default_inventory_account", {"account_type": "Stock"}],
["cost_center", {}], ["cost_center", {}],
["round_off_cost_center", {}], ["round_off_cost_center", {}],
["depreciation_cost_center", {}], ["depreciation_cost_center", {}],
["default_employee_advance_account", {"root_type": "Asset", "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", "account_currency": frm.doc.default_currency}], ["expenses_included_in_asset_valuation", {"account_type": "Expenses Included In Asset Valuation"}],
["capital_work_in_progress_account", {"account_type": "Capital Work in Progress", "account_currency": frm.doc.default_currency}], ["capital_work_in_progress_account", {"account_type": "Capital Work in Progress"}],
["asset_received_but_not_billed", {"account_type": "Asset Received But Not Billed", "account_currency": frm.doc.default_currency}] ["asset_received_but_not_billed", {"account_type": "Asset Received But Not Billed"}]
], function(i, v) { ], function(i, v) {
erpnext.company.set_custom_query(frm, v); erpnext.company.set_custom_query(frm, v);
}); });