Merge pull request #42803 from barredterra/pseudo-translate-in-setup-wizard

This commit is contained in:
Raffael Meyer
2024-08-22 17:03:18 +02:00
committed by GitHub
13 changed files with 56 additions and 41 deletions

View File

@@ -48,7 +48,7 @@
"idx": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-03-27 13:10:05.597711",
"modified": "2024-08-16 19:22:42.942264",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Mode of Payment",
@@ -74,5 +74,6 @@
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "ASC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -17,7 +17,7 @@
}
],
"links": [],
"modified": "2024-03-27 13:10:04.846687",
"modified": "2024-08-16 19:24:55.811760",
"modified_by": "Administrator",
"module": "CRM",
"name": "Market Segment",
@@ -40,5 +40,6 @@
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
"track_changes": 1,
"translated_doctype": 1
}

View File

@@ -47,7 +47,7 @@
"icon": "icon-flag",
"idx": 1,
"links": [],
"modified": "2024-03-27 13:05:57.956050",
"modified": "2024-08-16 19:22:57.706521",
"modified_by": "Administrator",
"module": "Projects",
"name": "Activity Type",
@@ -84,5 +84,6 @@
"quick_entry": 1,
"sort_field": "creation",
"sort_order": "ASC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -26,7 +26,7 @@
}
],
"links": [],
"modified": "2024-03-27 13:10:21.571554",
"modified": "2024-08-16 19:24:29.480229",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project Type",
@@ -70,5 +70,6 @@
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
"track_changes": 1,
"translated_doctype": 1
}

View File

@@ -139,7 +139,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2024-03-27 13:06:48.550415",
"modified": "2024-08-16 19:21:41.880111",
"modified_by": "Administrator",
"module": "Setup",
"name": "Customer Group",
@@ -212,5 +212,6 @@
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "DESC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -17,9 +17,7 @@ class CustomerGroup(NestedSet):
from frappe.types import DF
from erpnext.accounts.doctype.party_account.party_account import PartyAccount
from erpnext.selling.doctype.customer_credit_limit.customer_credit_limit import (
CustomerCreditLimit,
)
from erpnext.selling.doctype.customer_credit_limit.customer_credit_limit import CustomerCreditLimit
accounts: DF.Table[PartyAccount]
credit_limits: DF.Table[CustomerCreditLimit]

View File

@@ -135,7 +135,7 @@
"is_tree": 1,
"links": [],
"max_attachments": 3,
"modified": "2024-03-27 13:09:54.588785",
"modified": "2024-08-16 19:20:36.401913",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",
@@ -206,5 +206,6 @@
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "DESC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -107,7 +107,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2024-03-27 13:10:48.734325",
"modified": "2024-08-16 19:22:02.022181",
"modified_by": "Administrator",
"module": "Setup",
"name": "Supplier Group",
@@ -170,5 +170,6 @@
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "ASC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -123,7 +123,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2024-03-27 13:10:53.240951",
"modified": "2024-08-16 19:21:19.161490",
"modified_by": "Administrator",
"module": "Setup",
"name": "Territory",
@@ -188,5 +188,6 @@
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "DESC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -7,7 +7,6 @@ import os
from pathlib import Path
import frappe
from frappe import _
from frappe.desk.doctype.global_search_settings.global_search_settings import (
update_global_search_doctypes,
)
@@ -18,6 +17,14 @@ from erpnext.accounts.doctype.account.account import RootNotEditable
from erpnext.regional.address_template.setup import set_up_address_templates
def _(x, *args, **kwargs):
"""Redefine the translation function to return the string as is.
We want to create english records but still mark the strings as translatable.
The respective DocTypes have 'Translate Link Fields' enabled."""
return x
def read_lines(filename: str) -> list[str]:
"""Return a list of lines from a file in the data directory."""
return (Path(__file__).parent.parent / "data" / filename).read_text().splitlines()
@@ -68,49 +75,49 @@ def install(country=None):
# Stock Entry Type
{
"doctype": "Stock Entry Type",
"name": "Material Issue",
"name": _("Material Issue"),
"purpose": "Material Issue",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Material Receipt",
"name": _("Material Receipt"),
"purpose": "Material Receipt",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Material Transfer",
"name": _("Material Transfer"),
"purpose": "Material Transfer",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Manufacture",
"name": _("Manufacture"),
"purpose": "Manufacture",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Repack",
"name": _("Repack"),
"purpose": "Repack",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Send to Subcontractor",
"name": _("Send to Subcontractor"),
"purpose": "Send to Subcontractor",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Material Transfer for Manufacture",
"name": _("Material Transfer for Manufacture"),
"purpose": "Material Transfer for Manufacture",
"is_standard": 1,
},
{
"doctype": "Stock Entry Type",
"name": "Material Consumption for Manufacture",
"name": _("Material Consumption for Manufacture"),
"purpose": "Material Consumption for Manufacture",
"is_standard": 1,
},
@@ -274,9 +281,9 @@ def install(country=None):
{"doctype": "Opportunity Type", "name": _("Sales")},
{"doctype": "Opportunity Type", "name": _("Support")},
{"doctype": "Opportunity Type", "name": _("Maintenance")},
{"doctype": "Project Type", "project_type": "Internal"},
{"doctype": "Project Type", "project_type": "External"},
{"doctype": "Project Type", "project_type": "Other"},
{"doctype": "Project Type", "project_type": _("Internal")},
{"doctype": "Project Type", "project_type": _("External")},
{"doctype": "Project Type", "project_type": _("Other")},
{"doctype": "Print Heading", "print_heading": _("Credit Note")},
{"doctype": "Print Heading", "print_heading": _("Debit Note")},
# Share Management
@@ -370,8 +377,8 @@ def add_uom_data():
).read()
)
for d in uom_conversions:
if not frappe.db.exists("UOM Category", _(d.get("category"))):
frappe.get_doc({"doctype": "UOM Category", "category_name": _(d.get("category"))}).db_insert()
if not frappe.db.exists("UOM Category", d.get("category")):
frappe.get_doc({"doctype": "UOM Category", "category_name": d.get("category")}).db_insert()
if not frappe.db.exists(
"UOM Conversion Factor",
@@ -380,7 +387,7 @@ def add_uom_data():
frappe.get_doc(
{
"doctype": "UOM Conversion Factor",
"category": _(d.get("category")),
"category": d.get("category"),
"from_uom": d.get("from_uom"),
"to_uom": d.get("to_uom"),
"value": d.get("value"),
@@ -494,7 +501,6 @@ def update_stock_settings():
stock_settings.item_naming_by = "Item Code"
stock_settings.valuation_method = "FIFO"
stock_settings.default_warehouse = frappe.db.get_value("Warehouse", {"warehouse_name": _("Stores")})
stock_settings.stock_uom = _("Nos")
stock_settings.stock_uom = "Nos"
stock_settings.auto_indent = 1
stock_settings.auto_insert_price_list_rate_if_missing = 1

View File

@@ -84,7 +84,7 @@
"idx": 1,
"links": [],
"max_attachments": 1,
"modified": "2024-03-27 13:10:17.226079",
"modified": "2024-08-16 19:41:19.591111",
"modified_by": "Administrator",
"module": "Stock",
"name": "Price List",
@@ -130,5 +130,6 @@
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "ASC",
"states": []
"states": [],
"translated_doctype": 1
}

View File

@@ -37,7 +37,7 @@
}
],
"links": [],
"modified": "2024-08-20 15:35:45.696958",
"modified": "2024-08-22 16:00:22.696958",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Type",
@@ -88,5 +88,6 @@
"sort_field": "creation",
"sort_order": "ASC",
"states": [],
"track_changes": 1
"track_changes": 1,
"translated_doctype": 1
}

View File

@@ -15,7 +15,7 @@
}
],
"links": [],
"modified": "2024-03-27 13:09:53.126034",
"modified": "2024-08-16 19:23:40.697426",
"modified_by": "Administrator",
"module": "Support",
"name": "Issue Priority",
@@ -38,5 +38,6 @@
"sort_field": "creation",
"sort_order": "ASC",
"states": [],
"track_changes": 1
"track_changes": 1,
"translated_doctype": 1
}