Need to read the Item Net weight from tabItem when adding new line in quotation

Hi;


I have created a custom field net_weight in the Quotation Item doctype and need to read the item net_weiht from tabItem in this field when the user adds new line in the quotation and chooses the item.

How can I do this ?

Thanks.

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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3879a4b9-2637-4895-8c8d-6b4fa41f8ea5%40googlegroups.com?hl=en.

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

 

 

Hello HF,

You will need to write a custom add_fetch script to pull Net Weight of an item into Quotation.

Please check following link for help on writing Custom Script.

https://github.com/webnotes/wnframework/wiki/Client-side-scripting#using-add_fetch-to-pull-link-details

Hope this helps.


On Thu, May 16, 2013 at 3:03 PM, HF <gm...@gmail.com> wrote:
Hi;

I have created a custom field net_weight in the Quotation Item doctype and need to read the item net_weiht from tabItem in this field when the user adds new line in the quotation and chooses the item.

How can I do this ?

Thanks.

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-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3879a4b9-2637-4895-8c8d-6b4fa41f8ea5%40googlegroups.com?hl=en.

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









Thanks and Regards,

Umair Sayyed
www.erpnext.com



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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

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

 

 

Hi Umair;


I defined the script as client, in Quotation Item document as follows:

cur_frm.add_fetch(‘Item’,‘net_weight’,‘gross_weight’)

But it does not work ??




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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/2cd1780e-af2d-4408-a621-a8112c01b9ed%40googlegroups.com?hl=en.

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

 

 

HF,

In your first email, you mentioned that field added in the Quotation Item is Net Weight. Also, Net Weight is to be pulled from item master. Do you want to pull Gross Weight as well?

The script to pull Net Weight from Item master and fetch into Net Weight field of Quotation will be:

cur_frm.add_fetch('Item_code','net_weight','net_weight')

In Custom Script, Doctype will be Quotation (and not Quotation Item).

Hope this helps.



On Thu, May 16, 2013 at 4:34 PM, HF <gm...@gmail.com> wrote:
Hi Umair;

I defined the script as client, in Quotation Item document as follows:

cur_frm.add_fetch('Item','net_weight','gross_weight')

But it does not work ??




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-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/2cd1780e-af2d-4408-a621-a8112c01b9ed%40googlegroups.com?hl=en.


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





--
Thanks and Regards,
Umair Sayyed
www.erpnext.com



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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

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

 

 

Please select the document as "Quotation" and code will be: 
cur_frm.add_fetch("item_code", "net_weight", "gross_weight")

On 16-May-2013, at 4:34 PM, HF wrote:

Hi Umair;

I defined the script as client, in Quotation Item document as follows:

cur_frm.add_fetch('Item','net_weight','gross_weight')

But it does not work ??





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-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/2cd1780e-af2d-4408-a621-a8112c01b9ed%40googlegroups.com?hl=en.

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

 

 




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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

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

 

 

Hi Umair;


It should display the value in the screen as soon as I choose the item isn’t it ?

It doen’t work ?



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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/b8b76a58-250d-4564-b93f-6ab887cb5f3f%40googlegroups.com?hl=en.

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

 

 

Hi HF,

You will need to go to tools > clear cache & refresh after updating the custom script for it to take effect.

I've tried the code in my local and it works:

cur_frm.add_fetch("item_code", "net_weight", "test_net_weight");

where test_net_weight is the target fieldname I had in the item table. Put this code in the custom script of the main form where you want to pull the net weight and not the item form.

Thanks,
Anand.

On 16-May-2013, at 5:00 PM, HF <gm...@gmail.com> wrote:

Hi Umair;

It should display the value in the screen as soon as I choose the item isn't it ?

It doen't work ?




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-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/b8b76a58-250d-4564-b93f-6ab887cb5f3f%40googlegroups.com?hl=en.

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

 

 




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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

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

 

 

Hi Anand;


In my case test_net_weight is in Quotation Item table not in Item table like your example …??


On Thursday, May 16, 2013 1:48:14 PM UTC+2, Anand Doshi wrote:
Hi HF,

You will need to go to tools > clear cache & refresh after updating the custom script for it to take effect.

I’ve tried the code in my local and it works:

cur_frm.add_fetch(“item_code”, “net_weight”, “test_net_weight”);

where test_net_weight is the target fieldname I had in the item table. Put this code in the custom script of the main form where you want to pull the net weight and not the item form.

Thanks,
Anand.

On 16-May-2013, at 5:00 PM, HF <gm…@gmail.com> wrote:

Hi Umair;

It should display the value in the screen as soon as I choose the item isn’t it ?

It doen’t work ?




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-forum+un…@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/msgid/erpnext-developer-forum/b8b76a58-250d-4564-b93f-6ab887cb5f3f%40googlegroups.com?hl=en.

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

 

 




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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1a17c6bd-efc7-4a41-b75e-7ba6c00823be%40googlegroups.com?hl=en.

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

 

 

Yes. I meant Item Entry table in the Quotation Form.

So in your case, create a Custom Script / edit existing Custom Script of Quotation DocType and enter:

cur_frm.add_fetch("item_code", "net_weight", "test_net_weight");

Replace test_net_weight with the field in the Quotation Item. Then go to Tools (last icon on top bar) > Clear Cache & Refresh. This will make sure that the new custom script is included in the javascript code.

After this, it should work, provided that net weight value exists in the Item form for that Item.

Thanks,
Anand.

On 16-May-2013, at 6:12 PM, HF <gm...@gmail.com> wrote:

Hi Anand;

In my case test_net_weight is in Quotation Item table not in Item table like your example ....??


On Thursday, May 16, 2013 1:48:14 PM UTC+2, Anand Doshi wrote:
Hi HF,

You will need to go to tools > clear cache & refresh after updating the custom script for it to take effect.

I've tried the code in my local and it works:

cur_frm.add_fetch("item_code", "net_weight", "test_net_weight");

where test_net_weight is the target fieldname I had in the item table. Put this code in the custom script of the main form where you want to pull the net weight and not the item form.

Thanks,
Anand.

On 16-May-2013, at 5:00 PM, HF <gm...@gmail.com> wrote:

Hi Umair;

It should display the value in the screen as soon as I choose the item isn't it ?

It doen't work ?




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-forum+un…@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/msgid/erpnext-developer-forum/b8b76a58-250d-4564-b93f-6ab887cb5f3f%40googlegroups.com?hl=en.

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

 

 





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-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1a17c6bd-efc7-4a41-b75e-7ba6c00823be%40googlegroups.com?hl=en.

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

 

 




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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

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

 

 

Hi Anand;


It works, sorry it was my fault I found that I have another script for the same doctype so I put this code with the old script and deleted the new script and it works.

Thanks.




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-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/28ccdbf0-f496-4e08-a6de-368e15c51c0f%40googlegroups.com?hl=en.

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