From 0b3ecd24e21ec1f2ba490cf10d880bcdb6ec584a Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:29:40 +0100 Subject: [PATCH] feat: pass doctype as context when translating label --- .../print_format/sales_invoice_return/sales_invoice_return.html | 2 +- .../doctype/item_variant_settings/item_variant_settings.js | 2 +- erpnext/templates/form_grid/includes/visible_cols.html | 2 +- erpnext/templates/print_formats/includes/total.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/print_format/sales_invoice_return/sales_invoice_return.html b/erpnext/accounts/print_format/sales_invoice_return/sales_invoice_return.html index 3d5a9b1da9..e1771247e8 100644 --- a/erpnext/accounts/print_format/sales_invoice_return/sales_invoice_return.html +++ b/erpnext/accounts/print_format/sales_invoice_return/sales_invoice_return.html @@ -5,7 +5,7 @@
- +
{% if doc.get(df.fieldname) != None -%} diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js index 058783c4ae..457e48fdaf 100644 --- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js +++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js @@ -15,7 +15,7 @@ frappe.ui.form.on('Item Variant Settings', { frappe.model.with_doctype('Item', () => { const field_label_map = {}; frappe.get_meta('Item').fields.forEach(d => { - field_label_map[d.fieldname] = __(d.label) + ` (${d.fieldname})`; + field_label_map[d.fieldname] = __(d.label, null, d.parent) + ` (${d.fieldname})`; if (!in_list(exclude_field_types, d.fieldtype) && !d.no_copy && !in_list(exclude_fields, d.fieldname)) { diff --git a/erpnext/templates/form_grid/includes/visible_cols.html b/erpnext/templates/form_grid/includes/visible_cols.html index 3a0cc8d723..8d79bcdf87 100644 --- a/erpnext/templates/form_grid/includes/visible_cols.html +++ b/erpnext/templates/form_grid/includes/visible_cols.html @@ -3,7 +3,7 @@ if((df.fieldname !== "description" && df.fieldname !== "item_name") && val) { %}
- {%= __(df.label) %}: + {%= __(df.label, null, df.parent) %}:
{%= doc.get_formatted(df.fieldname) %} diff --git a/erpnext/templates/print_formats/includes/total.html b/erpnext/templates/print_formats/includes/total.html index 879203bbf2..66d48b2d18 100644 --- a/erpnext/templates/print_formats/includes/total.html +++ b/erpnext/templates/print_formats/includes/total.html @@ -7,7 +7,7 @@
{% else %}
-
+
{{ doc.get_formatted("total", doc) }}