@Nick
While using the same, it giving me an error saying, df is not defined.
BTW: Here is the solution of the problem, I was looking for. I actually was looking to set the list_view property using script and by using the below script, you can change any property of any field:
var d1 = {
"field_name": "video"
}
frappe.call({
args: d1,
method: "library.update_items.set_property",
callback: function(r)
{ }
@frappe.whitelist()
def set_property(field_name):
make_property_setter('Shipping List', field_name, "in_list_view", 0, "Check")
In the above example ’
Shipping List: Is a DocType
field_name: is the name of the field
in_list_view: is the property that I want to set, you can pass any property like shown below:
idx’: ‘Int’,
‘label’: ‘Data’,
‘fieldtype’: ‘Select’,
‘options’: ‘Text’,
‘permlevel’: ‘Int’,
‘width’: ‘Data’,
‘print_width’: ‘Data’,
‘reqd’: ‘Check’,
‘unique’: ‘Check’,
‘ignore_user_permissions’: ‘Check’,
‘in_list_view’: ‘Check’,
‘in_standard_filter’: ‘Check’,
‘in_global_search’: ‘Check’,
‘bold’: ‘Check’,
‘hidden’: ‘Check’,
‘collapsible’: ‘Check’,
‘collapsible_depends_on’: ‘Data’,
‘print_hide’: ‘Check’,
‘print_hide_if_no_value’: ‘Check’,
‘report_hide’: ‘Check’,
‘allow_on_submit’: ‘Check’,
‘depends_on’: ‘Data’,
‘description’: ‘Text’,
‘default’: ‘Text’,
‘precision’: ‘Select’,
‘read_only’: ‘Check’,
‘length’: ‘Int’,
‘columns’: ‘Int’,
‘remember_last_selected_value’: ‘Check’,
‘allow_bulk_edit’: ‘Check’,
0: is the value of the property means I am making in_list_view=no
check: is the type of the property like in_list_view is a check type property
To use the function make_property_setter
you need to import the library using:
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
in your python code.
For further details see customize_form.py
Regards
Ruchin Sharma