Need to change the quality inspection reading fields labels based on parameter field

63 views
Skip to first unread message

HF

unread,
Apr 4, 2013, 10:02:26 AM4/4/13
to erpnext-dev...@googlegroups.com
Hi;

I need to change the fields Labels (Reading 1, Reading 2, Reading 3, ....) in the Quality inspection readings document based on entered data in the parameter field in the same doc.

(custom script) how ?

Thanks.

HF

Rushabh Mehta

unread,
Apr 5, 2013, 12:39:01 AM4/5/13
to erpnext-dev...@googlegroups.com
HF,

You can go to Customize Form View and change labels in "Quality Inspection Reading"

best,
Rushabh



HF

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/eEhAawo4BZwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta

HF

unread,
Apr 5, 2013, 7:36:19 AM4/5/13
to erpnext-dev...@googlegroups.com
Hi ;

I need it to be dynamically change when the user change the parameter field or the naming series field in the same screen.

Lets say if the user choose naming series QA/  the labels for the specification details table for Reading 1, Reading 2, ... will be xxx1 , xxx2, ....
and if the user chooses naming series QB/  the labels for the specification details table for Reading 1, Reading 2, ... will be yyy1 , yyy2, ....

Thanks.


Rushabh Mehta

unread,
Apr 8, 2013, 12:52:07 AM4/8/13
to erpnext-dev...@googlegroups.com
Hisham,

Sorry for the late reply.

This is not possible unless you write a complex custom script to change the labels. There is such a script for Sales Order where we change the table headings based on currency.


This basically involves identifying the column heading using jquery and then changing the label in the HTML dom.

You can use the technique in custom script and give it a shot.

best,
Rushabh




--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

HF

unread,
Apr 8, 2013, 4:00:43 AM4/8/13
to erpnext-dev...@googlegroups.com
Dear Rushabh;

I tried this in the custom script but it doen't work:

cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
     inspection_cols_base = {'reading_1': 'xxx1', 'reading_2': 'xxx2', 'reading_3': 'xxx3', 'reading_4': 'Reading 4', 'reading_5': 'Reading 5', 'reading_6': 'Reading 6', 'reading_7': 'Reading 7', 'reading_8': 'Reading 8', 'reading_9': 'Reading 9', 'reading_10': 'Reading 10'};
    for (d in inspection_cols_base) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(inspection_cols_base[d]);
    var hide = (doc.naming_series == 'QA') ? false : true;
for (f in inspection_cols_base) {
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
}
        callback(doc, cdt, cdn);
}
cur_frm.cscript.naming_series = cur_frm.cscript.dynamic_label;


Please advise.

Thanks.


 

Nabin Hait

unread,
Apr 8, 2013, 5:54:38 AM4/8/13
to erpnext-dev...@googlegroups.com
HF,

I have made the following gist based on your requirements.


I have not tested the code, please change as per your requirement and test it.

Regards,
Nabin Hait

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

HF

unread,
Apr 8, 2013, 10:20:37 AM4/8/13
to erpnext-dev...@googlegroups.com
Dear Nabin;

It works from first time,... well done Nabin it solves me a complicated problem.

Thanks.

Aditya Duggal

unread,
Apr 25, 2014, 4:01:12 AM4/25/14
to erpnext-dev...@googlegroups.com
Hi Nabin,

I just tried this thing to change my labels in Item Page but I am unable to get the desired results, there is no error but the function is giving me a alert as desired but the Labels are not changing.

My code is here.

Now I have called the function to change the labels on line# 84 and the function to change the labels start from line# 298

Now the problem is that function is being called correctly and I am also able to see the correct labels in the ALERT message on line 307 and 308 but the actual labels of the field are unchanged....I know I am missing something but I am not able to find what?

I have taken cue from your gist here.

rushabh

unread,
Apr 26, 2014, 12:10:20 AM4/26/14
to erpnext-dev...@googlegroups.com
Aditya,

To change label, use:

cur_frm.set_df_property("fieldname", "label", "My Label")


Try it from your console first to check if it works.

best,
Rushabh
Reply all
Reply to author
Forward
0 new messages