From 8b3d6ee7b0cd080daa515549b24b409e2570b34f Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Wed, 10 May 2023 16:16:50 +0530 Subject: [PATCH 1/5] fix(Salary Slip): exchange rate overwritten on form load (#507) (#35245) --- .../doctype/salary_slip/salary_slip.js | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.js b/erpnext/payroll/doctype/salary_slip/salary_slip.js index 3ef9762a839..5fa25722071 100644 --- a/erpnext/payroll/doctype/salary_slip/salary_slip.js +++ b/erpnext/payroll/doctype/salary_slip/salary_slip.js @@ -80,22 +80,27 @@ frappe.ui.form.on("Salary Slip", { }, currency: function(frm) { + frm.trigger("update_currency_changes"); + }, + + update_currency_changes: function(frm) { + frm.trigger("set_exchange_rate"); frm.trigger("set_dynamic_labels"); }, 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) { frappe.run_serially([ - () => frm.events.set_exchange_rate(frm, company_currency), - () => frm.events.change_form_labels(frm, company_currency), - () => frm.events.change_grid_labels(frm), - () => frm.refresh_fields() + () => frm.events.change_form_labels(frm), + () => frm.events.change_grid_labels(frm), + () => 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.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); }, - 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", - "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); 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.refresh(); + // triggering events explicitly because structure is set on the server-side + // and currency is fetched from the structure + frm.trigger("update_currency_changes"); } }); } From a1d717053acd0b3b5dd1e746cf6ea777311846bf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 4 May 2023 15:38:35 +0530 Subject: [PATCH 2/5] fix: internal transfer condition (cherry picked from commit b5a2ccf21d0b0ca9fb4c8d958d29d60dcfb5ecb2) --- .../doctype/purchase_receipt/purchase_receipt.py | 2 +- erpnext/stock/stock_ledger.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 28bff671f62..0f4606d3947 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -369,7 +369,7 @@ class PurchaseReceipt(BuyingController): ) outgoing_amount = d.base_net_amount - if self.is_internal_supplier and d.valuation_rate: + if self.is_internal_transfer() and d.valuation_rate: outgoing_amount = abs( frappe.db.get_value( "Stock Ledger Entry", diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 361e00a8449..2f876cddac8 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -536,7 +536,7 @@ class update_entries_after(object): sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"] and sle.voucher_detail_no and sle.actual_qty < 0 - and frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_internal_supplier") + and is_internal_transfer(sle) ): sle.outgoing_rate = get_incoming_rate_for_inter_company_transfer(sle) @@ -648,7 +648,7 @@ class update_entries_after(object): elif ( sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"] and sle.voucher_detail_no - and frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_internal_supplier") + and is_internal_transfer(sle) ): rate = get_incoming_rate_for_inter_company_transfer(sle) else: @@ -1488,3 +1488,15 @@ def get_incoming_rate_for_inter_company_transfer(sle) -> float: ) return rate + + +def is_internal_transfer(sle): + data = frappe.get_cached_value( + sle.voucher_type, + sle.voucher_no, + ["is_internal_supplier", "represents_company", "company"], + as_dict=True, + ) + + if data.is_internal_supplier and data.represents_company == data.company: + return True From 77f548c8145c69d4ceaddcd1f0b0449729c5291d Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 12 May 2023 11:40:15 +0530 Subject: [PATCH 3/5] fix: update reference data for statistical component --- erpnext/payroll/doctype/salary_slip/salary_slip.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py index d141ac68e21..db19e0d8ba4 100644 --- a/erpnext/payroll/doctype/salary_slip/salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py @@ -653,15 +653,17 @@ class SalarySlip(TransactionBase): amount = self.eval_condition_and_formula(struct_row, data) if struct_row.statistical_component: + default_data[struct_row.abbr] = amount + # update statitical component amount in reference data based on payment days # since row for statistical component is not added to salary slip if struct_row.depends_on_payment_days: - joining_date, relieving_date = self.get_joining_and_relieving_dates() - default_data[struct_row.abbr] = amount - data[struct_row.abbr] = flt( - (flt(amount) * flt(self.payment_days) / cint(self.total_working_days)), - struct_row.precision("amount"), + payment_days_amount = ( + flt(amount) * flt(self.payment_days) / cint(self.total_working_days) + if self.total_working_days + else 0 ) + data[struct_row.abbr] = payment_days_amount 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) From e37b9030fb101804e822e4e766cc66470c9e9399 Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Fri, 12 May 2023 15:06:03 +0530 Subject: [PATCH 4/5] fix: add missing options for `Content Align` (cherry picked from commit d16caa2d2c0d2bbdf36e2d698b5d3fb9809c47a3) --- erpnext/e_commerce/web_template/hero_slider/hero_slider.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/e_commerce/web_template/hero_slider/hero_slider.json b/erpnext/e_commerce/web_template/hero_slider/hero_slider.json index 2b1807c9651..39b2b3eaeb8 100644 --- a/erpnext/e_commerce/web_template/hero_slider/hero_slider.json +++ b/erpnext/e_commerce/web_template/hero_slider/hero_slider.json @@ -165,6 +165,7 @@ "fieldname": "slide_3_content_align", "fieldtype": "Select", "label": "Content Align", + "options": "Left\nCentre\nRight", "reqd": 0 }, { @@ -214,6 +215,7 @@ "fieldname": "slide_4_content_align", "fieldtype": "Select", "label": "Content Align", + "options": "Left\nCentre\nRight", "reqd": 0 }, { @@ -263,6 +265,7 @@ "fieldname": "slide_5_content_align", "fieldtype": "Select", "label": "Content Align", + "options": "Left\nCentre\nRight", "reqd": 0 }, { @@ -274,7 +277,7 @@ } ], "idx": 2, - "modified": "2021-02-24 15:57:05.889709", + "modified": "2023-05-12 15:03:57.604060", "modified_by": "Administrator", "module": "E-commerce", "name": "Hero Slider", From 188cfc2e3c0876233bceb169896ccddaef191eb9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 18:58:23 +0530 Subject: [PATCH 5/5] fix: cancelled vouchers in tax withheld vouchers list (#35309) fix: cancelled vouchers in tax withheld vouchers list (#35309) (cherry picked from commit 776a83066db63e84cc6e7dac804c581343f81ccd) Co-authored-by: ruthra kumar --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 76b85ecf0e2..f430b64db83 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -303,7 +303,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ apply_tds: function(frm) { var me = this; - + me.frm.set_value("tax_withheld_vouchers", []); if (!me.frm.doc.apply_tds) { me.frm.set_value("tax_withholding_category", ''); me.frm.set_df_property("tax_withholding_category", "hidden", 1);