Using wn: wn.model.get, wn.datetime.add_days,

Can someone please explain for me what is the wn that is use in wn.model.get, wn.datetime.add_days?
Is it frappe class or what exactly?

Also I appreciate if someone can explain for me how it is work in the below example?

// restrict certain warehouse to Material Manager
cur_frm.cscript.custom_validate = function(doc) {
    if(user_roles.indexOf("Material Manager")==-1) {

        var restricted_in_source = wn.model.get("Stock Entry Detail", 
            {, s_warehouse:"Restricted"});

        var restricted_in_target = wn.model.get("Stock Entry Detail",
            {, t_warehouse:"Restricted"})

        if(restricted_in_source.length || restricted_in_target.length) {
            msgprint("Only Material Manager can make entry in Restricted Warehouse");
            validated = false;


wn.model.get and wn.datetime.add_days methods are deprecated use the frappe.model.get_list and frappe.datetime.add_days methods instead.

frappe.model.get_list can be use to fetch the field values of the documents available in the locals
frappe.datetime.add_days is used to add the n days in your date field.

e.g. var restricted_in_source = frappe.model.get_list(“Stock Entry Detail”,
{parent:“STE-00001”, s_warehouse:“Restricted”});

above method will fetch the child table entries from STE-00001 where source warehouse is Restricted.


1 Like

Wonderful and thanks a lot for your kindly explanation.
But still I would to know the meaning for the wn. that is deprecated, it is shortcut for what?



wn is short for webnotes it was the framework name that later renamed to frappe

1 Like