fix: don't set "Company:company:default_currency" as default for currency link fields (#25095)

* fix: don't set Company:company:default_currency as default for currency link fields

* fix: Company:company:default_currency and refactor

Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com>
Co-authored-by: Afshan <afshan13k@gmail.com>
This commit is contained in:
Prssanna Desai 2021-03-31 21:52:48 +05:30 committed by GitHub
parent 7d3eda47b4
commit f3c34aa6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 60 additions and 28 deletions

View File

@ -181,7 +181,6 @@
"read_only": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.employee)",
"fieldname": "currency",
"fieldtype": "Link",
@ -201,7 +200,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-11-25 12:01:55.980721",
"modified": "2021-03-31 14:42:47.321368",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Advance",

View File

@ -130,7 +130,6 @@
"read_only": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.employee)",
"fieldname": "currency",
"fieldtype": "Link",
@ -155,7 +154,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-11-25 11:56:06.777241",
"modified": "2021-03-31 14:45:27.948207",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Encashment",

View File

@ -163,7 +163,6 @@
"read_only": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.employee)",
"fieldname": "currency",
"fieldtype": "Link",
@ -176,7 +175,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-10-20 17:51:13.419716",
"modified": "2021-03-31 14:45:48.566756",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Additional Salary",

View File

@ -124,7 +124,6 @@
"read_only": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.employee)",
"fieldname": "currency",
"fieldtype": "Link",
@ -148,7 +147,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-12-14 15:52:08.566418",
"modified": "2021-03-31 14:46:22.465521",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Employee Benefit Application",

View File

@ -21,7 +21,6 @@ frappe.ui.form.on('Employee Benefit Claim', {
callback: function(r) {
if (r.message) {
frm.set_value('currency', r.message);
frm.set_df_property('currency', 'hidden', 0);
}
}
});

View File

@ -125,10 +125,9 @@
"label": "Attachments"
},
{
"default": "Company:company:default_currency",
"depends_on": "eval: doc.employee",
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 1,
"label": "Currency",
"options": "Currency",
"read_only": 1,
@ -145,7 +144,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-11-25 11:49:56.097352",
"modified": "2021-03-31 15:51:51.489269",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Employee Benefit Claim",

View File

@ -75,7 +75,6 @@
"reqd": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.employee)",
"fieldname": "currency",
"fieldtype": "Link",
@ -95,7 +94,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-10-20 17:22:16.468042",
"modified": "2021-03-31 14:48:00.919839",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Employee Incentive",

View File

@ -47,5 +47,26 @@ frappe.ui.form.on('Employee Tax Exemption Declaration', {
});
}).addClass("btn-primary");
}
},
employee: function(frm) {
if (frm.doc.employee) {
frm.trigger('get_employee_currency');
}
},
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

@ -108,7 +108,7 @@
"read_only": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval: doc.employee",
"fieldname": "currency",
"fieldtype": "Link",
"label": "Currency",
@ -119,7 +119,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-10-20 16:42:24.493761",
"modified": "2021-03-31 20:41:57.387749",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Employee Tax Exemption Declaration",

View File

@ -58,5 +58,26 @@ frappe.ui.form.on('Employee Tax Exemption Proof Submission', {
currency: function(frm) {
frm.refresh_fields();
},
employee: function(frm) {
if (frm.doc.employee) {
frm.trigger('get_employee_currency');
}
},
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

@ -131,7 +131,7 @@
"read_only": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval: doc.employee",
"fieldname": "currency",
"fieldtype": "Link",
"label": "Currency",
@ -142,7 +142,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-10-20 16:47:03.410020",
"modified": "2021-03-31 20:48:32.639885",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Employee Tax Exemption Proof Submission",

View File

@ -93,7 +93,7 @@
"options": "Income Tax Slab Other Charges"
},
{
"default": "Company:company:default_currency",
"fetch_from": "company.default_currency",
"fieldname": "currency",
"fieldtype": "Link",
"label": "Currency",
@ -104,7 +104,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-10-19 13:54:24.728075",
"modified": "2021-03-31 20:53:33.323712",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Income Tax Slab",

View File

@ -93,7 +93,6 @@
"reqd": 1
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.employee)",
"fieldname": "currency",
"fieldtype": "Link",
@ -106,7 +105,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-10-20 17:27:47.003134",
"modified": "2021-03-31 14:50:29.401020",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Retention Bonus",

View File

@ -500,7 +500,6 @@
"fieldtype": "Column Break"
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.salary_structure)",
"fetch_from": "salary_structure.currency",
"fieldname": "currency",
@ -632,7 +631,7 @@
"idx": 9,
"is_submittable": 1,
"links": [],
"modified": "2021-02-19 11:48:05.383945",
"modified": "2021-03-31 15:39:28.817166",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Salary Slip",

View File

@ -232,7 +232,7 @@
"idx": 1,
"is_submittable": 1,
"links": [],
"modified": "2020-09-30 11:30:32.190798",
"modified": "2021-03-31 15:41:12.342380",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Salary Structure",

View File

@ -125,7 +125,6 @@
"options": "Income Tax Slab"
},
{
"default": "Company:company:default_currency",
"depends_on": "eval:(doc.docstatus==1 || doc.salary_structure)",
"fetch_from": "salary_structure.currency",
"fieldname": "currency",
@ -146,7 +145,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2020-11-30 18:07:48.251311",
"modified": "2021-03-31 15:49:36.361253",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Salary Structure Assignment",