From 1e422f2383f2b1acb32a248a4322f90bf95f50f4 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 14 Feb 2018 22:17:51 +0530 Subject: [PATCH] Patch to enable translatable --- erpnext/patches.txt | 1 + .../v10_0/update_translatable_fields.py | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 erpnext/patches/v10_0/update_translatable_fields.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 69d8a4752c..770a2fd8c5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -494,3 +494,4 @@ erpnext.patches.v10_0.set_default_payment_terms_based_on_company erpnext.patches.v10_0.update_sales_order_link_to_purchase_order erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 erpnext.patches.v10_0.item_barcode_childtable_migrate +erpnext.patches.v10_0.update_translatable_fields \ No newline at end of file diff --git a/erpnext/patches/v10_0/update_translatable_fields.py b/erpnext/patches/v10_0/update_translatable_fields.py new file mode 100644 index 0000000000..9d6bda7168 --- /dev/null +++ b/erpnext/patches/v10_0/update_translatable_fields.py @@ -0,0 +1,41 @@ +#-*- coding: utf-8 -*- + +from __future__ import unicode_literals + +import frappe + +def execute(): + ''' + Enable translatable in these fields + - Customer Name + - Supplier Name + - Contact Name + - Item Name/ Description + - Address + ''' + + frappe.reload_doc('core', 'doctype', 'docfield') + frappe.reload_doc('custom', 'doctype', 'custom_field') + + enable_for_fields = [ + ['Customer', 'customer_name'], + ['Supplier', 'supplier_name'], + ['Contact', 'first_name'], + ['Contact', 'last_name'], + ['Item', 'item_name'], + ['Item', 'description'], + ['Address', 'address_line1'], + ['Address', 'address_line2'], + ] + + + for f in enable_for_fields: + 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()