Merge pull request #35323 from frappe/version-13-hotfix

chore: release v13
This commit is contained in:
Deepesh Garg
2023-05-16 22:28:02 +05:30
committed by GitHub
4 changed files with 30 additions and 15 deletions

View File

@@ -303,7 +303,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
apply_tds: function(frm) { apply_tds: function(frm) {
var me = this; var me = this;
me.frm.set_value("tax_withheld_vouchers", []);
if (!me.frm.doc.apply_tds) { if (!me.frm.doc.apply_tds) {
me.frm.set_value("tax_withholding_category", ''); me.frm.set_value("tax_withholding_category", '');
me.frm.set_df_property("tax_withholding_category", "hidden", 1); me.frm.set_df_property("tax_withholding_category", "hidden", 1);

View File

@@ -165,6 +165,7 @@
"fieldname": "slide_3_content_align", "fieldname": "slide_3_content_align",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Content Align", "label": "Content Align",
"options": "Left\nCentre\nRight",
"reqd": 0 "reqd": 0
}, },
{ {
@@ -214,6 +215,7 @@
"fieldname": "slide_4_content_align", "fieldname": "slide_4_content_align",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Content Align", "label": "Content Align",
"options": "Left\nCentre\nRight",
"reqd": 0 "reqd": 0
}, },
{ {
@@ -263,6 +265,7 @@
"fieldname": "slide_5_content_align", "fieldname": "slide_5_content_align",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Content Align", "label": "Content Align",
"options": "Left\nCentre\nRight",
"reqd": 0 "reqd": 0
}, },
{ {
@@ -274,7 +277,7 @@
} }
], ],
"idx": 2, "idx": 2,
"modified": "2021-02-24 15:57:05.889709", "modified": "2023-05-12 15:03:57.604060",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "E-commerce", "module": "E-commerce",
"name": "Hero Slider", "name": "Hero Slider",

View File

@@ -80,22 +80,27 @@ frappe.ui.form.on("Salary Slip", {
}, },
currency: function(frm) { currency: function(frm) {
frm.trigger("update_currency_changes");
},
update_currency_changes: function(frm) {
frm.trigger("set_exchange_rate");
frm.trigger("set_dynamic_labels"); frm.trigger("set_dynamic_labels");
}, },
set_dynamic_labels: function(frm) { set_dynamic_labels: function(frm) {
var company_currency = frm.doc.company? erpnext.get_currency(frm.doc.company): frappe.defaults.get_default("currency");
if (frm.doc.employee && frm.doc.currency) { if (frm.doc.employee && frm.doc.currency) {
frappe.run_serially([ frappe.run_serially([
() => frm.events.set_exchange_rate(frm, company_currency), () => frm.events.change_form_labels(frm),
() => frm.events.change_form_labels(frm, company_currency),
() => frm.events.change_grid_labels(frm), () => frm.events.change_grid_labels(frm),
() => frm.refresh_fields() () => frm.refresh_fields()
]); ]);
} }
}, },
set_exchange_rate: function(frm, company_currency) { set_exchange_rate: function(frm) {
const company_currency = erpnext.get_currency(frm.doc.company);
if (frm.doc.docstatus === 0) { if (frm.doc.docstatus === 0) {
if (frm.doc.currency) { if (frm.doc.currency) {
var from_currency = frm.doc.currency; var from_currency = frm.doc.currency;
@@ -133,9 +138,11 @@ frappe.ui.form.on("Salary Slip", {
frm.set_df_property('section_break_43', 'hidden', 1); frm.set_df_property('section_break_43', 'hidden', 1);
}, },
change_form_labels: function(frm, company_currency) { change_form_labels: function(frm) {
const company_currency = erpnext.get_currency(frm.doc.company);
frm.set_currency_labels(["base_hour_rate", "base_gross_pay", "base_total_deduction", frm.set_currency_labels(["base_hour_rate", "base_gross_pay", "base_total_deduction",
"base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date", "gross_base_year_to_date"], "base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date", "base_gross_year_to_date"],
company_currency); company_currency);
frm.set_currency_labels(["hour_rate", "gross_pay", "total_deduction", "net_pay", "rounded_total", "total_in_words", "year_to_date", "month_to_date", "gross_year_to_date"], frm.set_currency_labels(["hour_rate", "gross_pay", "total_deduction", "net_pay", "rounded_total", "total_in_words", "year_to_date", "month_to_date", "gross_year_to_date"],
@@ -207,6 +214,9 @@ frappe.ui.form.on("Salary Slip", {
frm.fields_dict.absent_days.set_description(__("Unmarked Days is treated as {0}. You can can change this in {1}", [r.message, frappe.utils.get_form_link("Payroll Settings", "Payroll Settings", true)])); frm.fields_dict.absent_days.set_description(__("Unmarked Days is treated as {0}. You can can change this in {1}", [r.message, frappe.utils.get_form_link("Payroll Settings", "Payroll Settings", true)]));
} }
frm.refresh(); frm.refresh();
// triggering events explicitly because structure is set on the server-side
// and currency is fetched from the structure
frm.trigger("update_currency_changes");
} }
}); });
} }

View File

@@ -653,15 +653,17 @@ class SalarySlip(TransactionBase):
amount = self.eval_condition_and_formula(struct_row, data) amount = self.eval_condition_and_formula(struct_row, data)
if struct_row.statistical_component: if struct_row.statistical_component:
default_data[struct_row.abbr] = amount
# update statitical component amount in reference data based on payment days # update statitical component amount in reference data based on payment days
# since row for statistical component is not added to salary slip # since row for statistical component is not added to salary slip
if struct_row.depends_on_payment_days: if struct_row.depends_on_payment_days:
joining_date, relieving_date = self.get_joining_and_relieving_dates() payment_days_amount = (
default_data[struct_row.abbr] = amount flt(amount) * flt(self.payment_days) / cint(self.total_working_days)
data[struct_row.abbr] = flt( if self.total_working_days
(flt(amount) * flt(self.payment_days) / cint(self.total_working_days)), else 0
struct_row.precision("amount"),
) )
data[struct_row.abbr] = payment_days_amount
elif amount or struct_row.amount_based_on_formula and amount is not None: elif amount or struct_row.amount_based_on_formula and amount is not None:
default_amount = self.eval_condition_and_formula(struct_row, default_data) default_amount = self.eval_condition_and_formula(struct_row, default_data)