Hide field using python

Can someone please help me to hide Payment due date field from sales invoice using python.

I am using subscription, so when subscription generate new invoice due date should not be displayed.

@Saditi have you tried to hide field from doctype?

@arokia using hidden ?
Yes it will hide field permanently from sales invoice doctype only, and I want to hide the field from subscription.

@Saditi Can you add screenshot for my better understanding?

@Saditi maybe you can use js
frm.set_df_property("[payment due date]","hidden",1)
but before that to determine it should hidden or not, make a call method on py using frappe.call then on there u can make python function

reference:


Thanks @antzforwork, I will try this…

  • Correct way to use set_df_property is
    frm.set_df_property("field_name", "property", "value") .
  • So in your case, if you want to make payment due date hidden, then you will have to do the following
    frm.set_df_property("payment_due_date", "hidden", 1) .

Hi you can do this on python side using below code:
make_property_setter("Doctype Name","fieldname", "hidden", 0, "Check")
Where ‘Check’ is nothing but property type,as hidden property is of checkbox type.