Cuztomize field script

Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference

https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/journal_voucher/journal_voucher.js#L181


Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.

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





S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP95-hWw_VpcToVLirqR%2BgTSs2j8Nxu4f1yp8%3DaCmd8O1g%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Thanks,



but please inform me , what is the param of refresh_field() ....


Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg: 
cur_frm.cscript.field_name = function(doc,cdt,cdn){
     var d = local[cdt][cdn];
     ------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.

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





S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.

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

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg: 
cur_frm.cscript.field_name = function(doc,cdt,cdn){
     var d = local[cdt][cdn];
     ------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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 toerpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



-- 
S.S.Palande

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/423CC4A3-12A1-45BE-B348-40FE62656DBF%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg: 
cur_frm.cscript.field_name = function(doc,cdt,cdn){
     var d = local[cdt][cdn];
     ------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



-- 
S.S.Palande

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-32LNRKkJYeMzXHUfpgPpNdQiJOWg%2BUNrS1fbUzysv9A%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg: 
cur_frm.cscript.field_name = function(doc,cdt,cdn){
     var d = local[cdt][cdn];
     ------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



-- 
S.S.Palande

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-xRFanrAArjL7VkfNxmLSh%3D6SFJGzHWMjhWCpYmWPcGQ%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];
qty=q*d;
refresh_field(qty);
}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType" 
cdn stands for "Child Doc Name" 

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg: 
cur_frm.cscript.field_name = function(doc,cdt,cdn){
     var d = local[cdt][cdn];
     ------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



-- 
S.S.Palande

-- 
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
--- 
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi,



please tell me, what was it the params that needed by refresh_field..

im quite confused about it

im tried refresh_field("qty") to refresh qty value in materials table but its not working

Thanks

On 29 September 2014 14:44, Saurabh Palande <sa...@gmail.com> wrote:
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDNrF320-7m8S2ygLqWg770-aWE%2BSKBjfVu0pbzjEpurA%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Bobby,

Syntax:
refresh_field('field_name', row_name, 'child_table_name')

Ref below link:
https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/journal_voucher/journal_voucher.js#L189
Regards,

On Mon, Sep 29, 2014 at 6:07 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



please tell me, what was it the params that needed by refresh_field..

im quite confused about it

im tried refresh_field("qty") to refresh qty value in materials table but its not working

Thanks

On 29 September 2014 14:44, Saurabh Palande <sa...@gmail.com> wrote:
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDNrF320-7m8S2ygLqWg770-aWE%2BSKBjfVu0pbzjEpurA%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_uyOA9%3DgM3N8TCwVFEmrqwVfp6hqXtTyfVLfKLSULzwg%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi,

since this local or client scripting i think there is no row name , am i right ?
in the end i placed my script like this
cur_frm.csript.standard = function(doc,dt,dn){
var d = locals[dt][dn];
d.qty=flt(d.standard)*flt(doc.quantity);
refresh_field("qty",d.qty,"bom_materials");
}
but its not working ... nothing happend when i type in standard field
what am i mistaking ?
its giving me error "cur_frm.fields_dict[table_field].grid.grid_rows_by_docname[docname]"

Thanks

On 29 September 2014 20:28, Saurabh Palande <sa...@gmail.com> wrote:
Hi Bobby,

Syntax:
refresh_field('field_name', row_name, 'child_table_name')

Ref below link:
Regards,

On Mon, Sep 29, 2014 at 6:07 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



please tell me, what was it the params that needed by refresh_field..

im quite confused about it

im tried refresh_field("qty") to refresh qty value in materials table but its not working

Thanks

On 29 September 2014 14:44, Saurabh Palande <sa...@gmail.com> wrote:
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDNrF320-7m8S2ygLqWg770-aWE%2BSKBjfVu0pbzjEpurA%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_uyOA9%3DgM3N8TCwVFEmrqwVfp6hqXtTyfVLfKLSULzwg%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDGoAoNpo0PjcY0hO-CDUwF5zSO6yvT8tR1AFwuvpSwPw%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Did you add this Custom Script in "BOM" doctype?

-Anand.

On Mon, Sep 29, 2014 at 7:12 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,

since this local or client scripting i think there is no row name , am i right ?
in the end i placed my script like this
cur_frm.csript.standard = function(doc,dt,dn){
var d = locals[dt][dn];
d.qty=flt(d.standard)*flt(doc.quantity);
refresh_field("qty",d.qty,"bom_materials");
}
but its not working ... nothing happend when i type in standard field
what am i mistaking ?
its giving me error "cur_frm.fields_dict[table_field].grid.grid_rows_by_docname[docname]"

Thanks

On 29 September 2014 20:28, Saurabh Palande <sa...@gmail.com> wrote:
Hi Bobby,

Syntax:
refresh_field('field_name', row_name, 'child_table_name')

Ref below link:
Regards,

On Mon, Sep 29, 2014 at 6:07 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



please tell me, what was it the params that needed by refresh_field..

im quite confused about it

im tried refresh_field("qty") to refresh qty value in materials table but its not working

Thanks

On 29 September 2014 14:44, Saurabh Palande <sa...@gmail.com> wrote:
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDNrF320-7m8S2ygLqWg770-aWE%2BSKBjfVu0pbzjEpurA%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_uyOA9%3DgM3N8TCwVFEmrqwVfp6hqXtTyfVLfKLSULzwg%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDGoAoNpo0PjcY0hO-CDUwF5zSO6yvT8tR1AFwuvpSwPw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF2pHmDhfiE9NokbCBn3dE5_jM%2BjehzCrRsz-Mb%3D2U4g%2BQ%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Bobby,

instead of d.qty use d.name at second position in refresh_field method

Regards,

On Mon, Sep 29, 2014 at 7:13 PM, Anand Doshi <an...@erpnext.com> wrote:
Did you add this Custom Script in "BOM" doctype?

-Anand.

On Mon, Sep 29, 2014 at 7:12 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,

since this local or client scripting i think there is no row name , am i right ?
in the end i placed my script like this
cur_frm.csript.standard = function(doc,dt,dn){
var d = locals[dt][dn];
d.qty=flt(d.standard)*flt(doc.quantity);
refresh_field("qty",d.qty,"bom_materials");
}
but its not working ... nothing happend when i type in standard field
what am i mistaking ?
its giving me error "cur_frm.fields_dict[table_field].grid.grid_rows_by_docname[docname]"

Thanks

On 29 September 2014 20:28, Saurabh Palande <sa...@gmail.com> wrote:
Hi Bobby,

Syntax:
refresh_field('field_name', row_name, 'child_table_name')

Ref below link:
Regards,

On Mon, Sep 29, 2014 at 6:07 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



please tell me, what was it the params that needed by refresh_field..

im quite confused about it

im tried refresh_field("qty") to refresh qty value in materials table but its not working

Thanks

On 29 September 2014 14:44, Saurabh Palande <sa...@gmail.com> wrote:
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDNrF320-7m8S2ygLqWg770-aWE%2BSKBjfVu0pbzjEpurA%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_uyOA9%3DgM3N8TCwVFEmrqwVfp6hqXtTyfVLfKLSULzwg%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDGoAoNpo0PjcY0hO-CDUwF5zSO6yvT8tR1AFwuvpSwPw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF2pHmDhfiE9NokbCBn3dE5_jM%2BjehzCrRsz-Mb%3D2U4g%2BQ%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_yPNvi8yBS8tt75X%3DdP0FjpnL66WmeAMuf0FRngmWdTw%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Saurabh,

its working.... thanks...

Anand, Yes i doing it in BOM doctype....

Thanks,
Bobby

On 29 September 2014 20:54, Saurabh Palande <sa...@gmail.com> wrote:
Hi Bobby,

instead of d.qty use d.name at second position in refresh_field method

Regards,

On Mon, Sep 29, 2014 at 7:13 PM, Anand Doshi <an...@erpnext.com> wrote:
Did you add this Custom Script in "BOM" doctype?

-Anand.

On Mon, Sep 29, 2014 at 7:12 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,

since this local or client scripting i think there is no row name , am i right ?
in the end i placed my script like this
cur_frm.csript.standard = function(doc,dt,dn){
var d = locals[dt][dn];
d.qty=flt(d.standard)*flt(doc.quantity);
refresh_field("qty",d.qty,"bom_materials");
}
but its not working ... nothing happend when i type in standard field
what am i mistaking ?
its giving me error "cur_frm.fields_dict[table_field].grid.grid_rows_by_docname[docname]"

Thanks

On 29 September 2014 20:28, Saurabh Palande <sa...@gmail.com> wrote:
Hi Bobby,

Syntax:
refresh_field('field_name', row_name, 'child_table_name')

Ref below link:
Regards,

On Mon, Sep 29, 2014 at 6:07 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,



please tell me, what was it the params that needed by refresh_field..

im quite confused about it

im tried refresh_field("qty") to refresh qty value in materials table but its not working

Thanks

On 29 September 2014 14:44, Saurabh Palande <sa...@gmail.com> wrote:
Hi,

On Mon, Sep 29, 2014 at 12:49 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


im tried this:
cur_frm.cscript.standard = function(doc,dt,dn) {
var d=local[dt][dn];
var q = doc.quantity;
var qty=local[dt]["qty"];

d = locals[cdt][cdn], provides you child table's row object, hence no need to create it twice

To access the fields use d.standard and d. qty.

qty=q*d;

for multiplication use flt(doc.quantity)*flt(d.standard)


refresh_field(qty);

for setting up value and refreshing ref following link


}

but it didnt work, web console said that local is undifined
please advise

Thanks

On Sunday, September 28, 2014 7:19:36 PM UTC+7, saurabh palande wrote:
Hi,

cdt stands for "Child DocType"
cdn stands for "Child Doc Name"

Regards,

On Sun, Sep 28, 2014 at 5:46 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi,


what is cdt & cdn ? for better understanding


Thanks

On Sunday, September 28, 2014 6:37:59 PM UTC+7, saurabh palande wrote:
HI Bobby,

If field is on child table then use,

var d = local[cdt][cdn]
d.field_name

Regards,

On Sun, Sep 28, 2014 at 12:30 PM, Bobby Hartanto <bo...@gmail.com> wrote:
Hi Rusabh thanks,


now im confused about ...this part in this script :
i want to change field qty in BOM_materials table when im set the standard value in BOM_materials
which the value of qty is standard * quatity in BOM

i can read bom quantity by calling doc.quantity (since im doing this in BOM script) , but i dont know how i can call the standard filed and qty field which is in the BOM_Materils
please advise ...


Thanks

On Sunday, September 28, 2014 12:17:01 PM UTC+7, rushabh wrote:

On 28-Sep-2014, at 10:02 am, Bobby Hartanto <bo...@gmail.com> wrote:

Hi Thanks,



but please inform me , what is the param of refresh_field() ....

Should be refresh_field(fieldname)

you can also use - this will also refresh the field

cur_frm.set_value(fieldname, value)




Thanks
Bobby

On Saturday, September 27, 2014 4:39:27 PM UTC+7, saurabh palande wrote:
Hi Bobby,

Just add trigger on custom field,

eg:
cur_frm.cscript.field_name = function(doc,cdt,cdn){
var d = local[cdt][cdn];
------- your code ---------
}

Please consider following link for reference



Generally we use cur_frm.set_vaue() to set result to output field and then use refresh_field() to refresh the field.


Regards,

On Sat, Sep 27, 2014 at 12:33 PM, Bobby Hartanto <bobzz...@gmail.com> wrote:
Hi,



i just created field standard in my BOM item table , and i want to add
script that when i fill the value of standard field the qty field will be
updated as (BOM quantity * standard value)
how can i do this ?
i know how to add script but i dont know what to write.... :(



Thanks,
Bobby

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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 toerpnext-developer-forum+unsubs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/111ea0e4-e8ab-4af3-a994-c225ca2a9c0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
S.S.Palande

--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f95c9c2e-aced-4bc8-a428-8ca663ec8f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



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

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6e380952-a82d-4082-80ca-bc70396b671f%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/bdba6240-97b2-43cd-95c2-814cc2a29560%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/03ac2863-8eff-42a1-9bd9-418c306434f9%40googlegroups.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP-HpDtuSikso4xWDKwF6pS0TCjA8XCPeTiPjb6wHuyYRw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDNrF320-7m8S2ygLqWg770-aWE%2BSKBjfVu0pbzjEpurA%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_uyOA9%3DgM3N8TCwVFEmrqwVfp6hqXtTyfVLfKLSULzwg%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sDGoAoNpo0PjcY0hO-CDUwF5zSO6yvT8tR1AFwuvpSwPw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF2pHmDhfiE9NokbCBn3dE5_jM%2BjehzCrRsz-Mb%3D2U4g%2BQ%40mail.gmail.com.


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



--
S.S.Palande


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to a topic in the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/X_Bcm5n-cHo/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAGCrPP_yPNvi8yBS8tt75X%3DdP0FjpnL66WmeAMuf0FRngmWdTw%40mail.gmail.com.


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


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    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 view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAL0R-sA%3DhC%2B8hU9wwd9s3fN8X63asQuu07Vn-ebsVFmBVOgwRA%40mail.gmail.com.

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