brotherton-erpnext/erpnext/patches/v10_0/update_translatable_fields.py

40 lines
805 B
Python
Raw Normal View History

2018-02-14 16:47:51 +00:00
import frappe
2018-02-14 16:47:51 +00:00
def execute():
2022-03-28 13:22:46 +00:00
"""
2018-02-14 16:47:51 +00:00
Enable translatable in these fields
- Customer Name
- Supplier Name
- Contact Name
- Item Name/ Description
- Address
2022-03-28 13:22:46 +00:00
"""
2018-02-14 16:47:51 +00:00
2022-03-28 13:22:46 +00:00
frappe.reload_doc("core", "doctype", "docfield")
frappe.reload_doc("custom", "doctype", "custom_field")
2018-02-14 16:47:51 +00:00
enable_for_fields = [
2022-03-28 13:22:46 +00:00
["Customer", "customer_name"],
["Supplier", "supplier_name"],
["Contact", "first_name"],
["Contact", "last_name"],
["Item", "item_name"],
["Item", "description"],
["Address", "address_line1"],
["Address", "address_line2"],
2018-02-14 16:47:51 +00:00
]
for f in enable_for_fields:
2022-03-28 13:22:46 +00:00
frappe.get_doc(
{
"doctype": "Property Setter",
"doc_type": f[0],
"doctype_or_field": "DocField",
"field_name": f[1],
"property": "translatable",
"propery_type": "Check",
"value": 1,
}
).db_insert()