From 1353a14a6b4c58b96916b3bf4f7a27e85716ab79 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:30:00 +0100 Subject: [PATCH] fix: in_contex_translation_fixes (cherry picked from commit a87e7fde031393607b384138b0927d0b4c36322b) # Conflicts: # erpnext/accounts/utils.py # erpnext/templates/pages/order.html --- .../closing_voucher_details.html | 10 ++--- erpnext/accounts/utils.py | 42 +++++++++++++++++++ erpnext/templates/pages/order.html | 4 ++ 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/pos_closing_entry/closing_voucher_details.html b/erpnext/accounts/doctype/pos_closing_entry/closing_voucher_details.html index 983f49563cd..5bc4e7a1587 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/closing_voucher_details.html +++ b/erpnext/accounts/doctype/pos_closing_entry/closing_voucher_details.html @@ -12,15 +12,15 @@ - {{ _('Grand Total') }} + {{ _("Grand Total") }} {{ frappe.utils.fmt_money(data.grand_total or '', currency=currency) }} - {{ _('Net Total') }} + {{ _("Net Total") }} {{ frappe.utils.fmt_money(data.net_total or '', currency=currency) }} - {{ _('Total Quantity') }} + {{ _("Total Quantity") }} {{ data.total_quantity or '' }} @@ -44,7 +44,7 @@ {% for d in data.payment_reconciliation %} - {{ d.mode_of_payment }} + {{ _(d.mode_of_payment) }} {{ frappe.utils.fmt_money(d.expected_amount - d.opening_amount, currency=currency) }} {% endfor %} @@ -63,7 +63,7 @@ {{ _("Account") }} - {{ _("Rate") }} + {{ _(" Tax Rate") }} {{ _("Amount") }} diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 51b4ed248ce..96f67613d3f 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -76,6 +76,48 @@ def get_fiscal_years( as_dict=False, boolean=False, ): +<<<<<<< HEAD +======= + if transaction_date: + transaction_date = getdate(transaction_date) + # backwards compat + if boolean is not None: + raise_on_missing = not boolean + + all_fiscal_years = _get_fiscal_years(company=company) + + # No restricting selectors + if not transaction_date and not fiscal_year: + return all_fiscal_years + + for fy in all_fiscal_years: + if (fiscal_year and fy.name == fiscal_year) or ( + transaction_date + and getdate(fy.year_start_date) <= transaction_date + and getdate(fy.year_end_date) >= transaction_date + ): + if as_dict: + return (fy,) + else: + return ((fy.name, fy.year_start_date, fy.year_end_date),) + + # No match for restricting selectors + if raise_on_missing: + error_msg = _("""{0} {1} is not in any active Fiscal Year""").format( + _(label), formatdate(transaction_date) + ) + if company: + error_msg = _("""{0} for {1}""").format(error_msg, frappe.bold(company)) + + if verbose == 1: + frappe.msgprint(error_msg) + + raise FiscalYearError(error_msg) + return [] + + +def _get_fiscal_years(company=None): +>>>>>>> a87e7fde03 (fix: in_contex_translation_fixes) fiscal_years = frappe.cache().hget("fiscal_years", company) or [] if not fiscal_years: diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index 388feb9eba9..ec565060191 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -40,7 +40,11 @@

+<<<<<<< HEAD {{ _("Pay") }} {{doc.get_formatted("grand_total") }} +======= + {{ _("Pay", null, "Amount") }} {{ pay_amount }} +>>>>>>> a87e7fde03 (fix: in_contex_translation_fixes)