Setting default value for tc_name (link) field on Purchase Order does not populate terms (text) field

Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev



You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.

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

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <eb...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev



You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

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



You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.

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

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <eb...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

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


  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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/60386A46-145E-49C9-84C8-0208A3CDAE04%40iwebnotes.com.

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

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/B9C83828-F930-4145-BA52-4F1F9AE41594%40iwebnotes.com.

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

SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/43A58543-9FD7-42E2-9796-5CF8C3146B94%40iwebnotes.com.

    For more options, visit https://groups.google.com/d/optout.
I have tried this:

cur_frm.cscript.custom_onload = function(doc) {
default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

I have also tried this:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", "Standard Sales Invoice Terms and Conditions");
}

Hope this is what you meant. Thanks Nabin.


On Tuesday, September 23, 2014 1:32:34 PM UTC+8, Nabin Hait wrote:
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/8280e5da-9dd4-4257-9b56-692e0a6e1f0a%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
I have also customised the Form so that in the tc_name field the "Default" is set to "Standard Sales Invoice Terms and Conditions".  Same result.

On Tuesday, September 23, 2014 1:36:21 PM UTC+8, Javier wrote:
I have tried this:

cur_frm.cscript.custom_onload = function(doc) {
default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

I have also tried this:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", "Standard Sales Invoice Terms and Conditions");
}

Hope this is what you meant. Thanks Nabin.


On Tuesday, September 23, 2014 1:32:34 PM UTC+8, Nabin Hait wrote:
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bbaae850-e464-4bbc-bbbb-06d6eb4a143f%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Can you try once after removing default value from Customize Form? Don’t forget to clear cache after removing.


On Sep 23, 2014, at 11:07 AM, Javier <bo...@gmail.com> wrote:

I have also customised the Form so that in the tc_name field the "Default" is set to "Standard Sales Invoice Terms and Conditions".  Same result.

On Tuesday, September 23, 2014 1:36:21 PM UTC+8, Javier wrote:
I have tried this:

cur_frm.cscript.custom_onload = function(doc) {
default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

I have also tried this:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", "Standard Sales Invoice Terms and Conditions");
}

Hope this is what you meant. Thanks Nabin.


On Tuesday, September 23, 2014 1:32:34 PM UTC+8, Nabin Hait wrote:
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bbaae850-e464-4bbc-bbbb-06d6eb4a143f%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/42A653C1-E455-4C81-B058-45F82631BD34%40iwebnotes.com.

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

I removed the default value from the customise form. Cleared Firefox Cache. Restarted the browser. Configured the following custom script. But experience the same issue. This is for Sales Invoice document BTW.

cur_frm.cscript.custom_onload = function(doc) {
    default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

Thank you.


Javier

On Tuesday, September 23, 2014 1:44:34 PM UTC+8, Nabin Hait wrote:
Can you try once after removing default value from Customize Form? Don’t forget to clear cache after removing.


On Sep 23, 2014, at 11:07 AM, Javier <bo...@gmail.com> wrote:

I have also customised the Form so that in the tc_name field the "Default" is set to "Standard Sales Invoice Terms and Conditions".  Same result.

On Tuesday, September 23, 2014 1:36:21 PM UTC+8, Javier wrote:
I have tried this:

cur_frm.cscript.custom_onload = function(doc) {
default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

I have also tried this:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", "Standard Sales Invoice Terms and Conditions");
}

Hope this is what you meant. Thanks Nabin.


On Tuesday, September 23, 2014 1:32:34 PM UTC+8, Nabin Hait wrote:
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bbaae850-e464-4bbc-bbbb-06d6eb4a143f%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/3b52d3cf-4657-4a3e-96ba-880db9b8fdef%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
I think I got the issue. You have put an unknown character before tc_name. It is not a simple double quote, try using double quote. 

    cur_frm.set_value(“tc_name", default_value);

cur_frm.set_value("tc_name", default_value;)



On Sep 23, 2014, at 11:32 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I removed the default value from the customise form. Cleared Firefox Cache. Restarted the browser. Configured the following custom script. But experience the same issue. This is for Sales Invoice document BTW.

cur_frm.cscript.custom_onload = function(doc) {
    default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

Thank you.


Javier

On Tuesday, September 23, 2014 1:44:34 PM UTC+8, Nabin Hait wrote:
Can you try once after removing default value from Customize Form? Don’t forget to clear cache after removing.


On Sep 23, 2014, at 11:07 AM, Javier <bo...@gmail.com> wrote:

I have also customised the Form so that in the tc_name field the "Default" is set to "Standard Sales Invoice Terms and Conditions".  Same result.

On Tuesday, September 23, 2014 1:36:21 PM UTC+8, Javier wrote:
I have tried this:

cur_frm.cscript.custom_onload = function(doc) {
default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

I have also tried this:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", "Standard Sales Invoice Terms and Conditions");
}

Hope this is what you meant. Thanks Nabin.


On Tuesday, September 23, 2014 1:32:34 PM UTC+8, Nabin Hait wrote:
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bbaae850-e464-4bbc-bbbb-06d6eb4a143f%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/3b52d3cf-4657-4a3e-96ba-880db9b8fdef%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/ECAC2572-11FB-46DD-9DC4-6AB562E3D8CD%40iwebnotes.com.

    For more options, visit https://groups.google.com/d/optout.
Wow bro!!... amazing... I could not have spotted it in a million years... Thank you. 

Works like a charm now.

On Tuesday, September 23, 2014 2:49:04 PM UTC+8, Nabin Hait wrote:
I think I got the issue. You have put an unknown character before tc_name. It is not a simple double quote, try using double quote. 

    cur_frm.set_value(“tc_name", default_value);

cur_frm.set_value("tc_name", default_value;)



On Sep 23, 2014, at 11:32 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I removed the default value from the customise form. Cleared Firefox Cache. Restarted the browser. Configured the following custom script. But experience the same issue. This is for Sales Invoice document BTW.

cur_frm.cscript.custom_onload = function(doc) {
    default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

Thank you.


Javier

On Tuesday, September 23, 2014 1:44:34 PM UTC+8, Nabin Hait wrote:
Can you try once after removing default value from Customize Form? Don’t forget to clear cache after removing.


On Sep 23, 2014, at 11:07 AM, Javier <bo...@gmail.com> wrote:

I have also customised the Form so that in the tc_name field the "Default" is set to "Standard Sales Invoice Terms and Conditions".  Same result.

On Tuesday, September 23, 2014 1:36:21 PM UTC+8, Javier wrote:
I have tried this:

cur_frm.cscript.custom_onload = function(doc) {
default_value="Standard Sales Invoice Terms and Conditions";
    cur_frm.set_value(“tc_name", default_value);
}

I have also tried this:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", "Standard Sales Invoice Terms and Conditions");
}

Hope this is what you meant. Thanks Nabin.


On Tuesday, September 23, 2014 1:32:34 PM UTC+8, Nabin Hait wrote:
Have you replaced default_value variable with some actual value inside quote?

On Sep 23, 2014, at 11:00 AM, Javier <bo...@gmail.com> wrote:


SyntaxError: illegal character frappe.min.js:1868


On Tuesday, September 23, 2014 1:28:06 PM UTC+8, Nabin Hait wrote:
What is the error in javascript console?

On Sep 23, 2014, at 10:54 AM, Javier <bo...@gmail.com> wrote:

Dear Nabin,

I tried:

cur_frm.cscript.custom_onload = function(doc) {
    cur_frm.set_value(“tc_name", default_value);
}

the Sales invoice comes up with a screen that shows just the section headers, all field elements are missing. FYI I entered a default value for tc_name under Customize form.

I also tried other field elements and the form seems to behave the same.

Any ideas?

Thank you.


Javier


On Tuesday, September 23, 2014 1:08:48 PM UTC+8, Nabin Hait wrote:
Inside custom_onload use: cur_frm.set_value(“tc_name", default_value)

It will trigger on change event for tc_name field and fetch terms.


On Sep 23, 2014, at 9:15 AM, Javier <bo...@gmail.com> wrote:

Hi Experts,

I understood from this thread that we need to create a custom script somewhere along the lines of:

cur_frm.cscript.custom_onload = function(doc) {
......

}

But can someone advise the code required to fetch the terms and conditions? Sorry, I am quite lost here. Thank you very much.


Javier


On Tuesday, January 14, 2014 12:13:39 PM UTC+8, Nabin Hait wrote:

You should write a function inside custom_onload, which will fetch terms based on default tc_name.

On 12 Jan 2014 08:25, "Jev Björsell" <ebjo...@gmail.com> wrote:
Hi All,

For Purchase Order, I set the default field value for the tc_name filed to "Terms Of Purchase" which is the name of a record in my `tabTerms and Conditions` table. When creating a new PO, the tc_name filed is properly populated with the default value, but the terms field is blank.

When setting the tc_name field via the web add, terms gets populated with the help of some javascript.


What is the appropriate way to have terms populated correctly? I do not want to hard code the default terms text in as the default valued for the 'terms' field as that wastes the value of the 'Terms and Conditions' feature that erpnext provides.


Thanks,
-Jev

-- 
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a7527a4a-6a61-4f0f-a986-7c5bdd079660%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/f742b775-e34e-45b3-ac05-42faa86b7166%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/c0bcf6ef-921d-4133-9bce-1cb003490883%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/bbaae850-e464-4bbc-bbbb-06d6eb4a143f%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 User’s Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/3b52d3cf-4657-4a3e-96ba-880db9b8fdef%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 User's Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/342ace7a-cd02-4e60-91f9-f0b67d4b8bf7%40googlegroups.com.

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

Hi Nabin and Bohlian,

This topic has been addressed for a while. I would like to do the same things. Customize a form with Link DocType on field called “tc_name”, while another field called “tc_text” for the text editor.

This custom onload function works fine, basically hardcoding the default value.

cur_frm.cscript.custom_tc_name = function(doc) {
default_value = “Terms and Conditions”;
cur_frm.set_value(“tc_text”, default_value);
}

But I would like to read from the Terms and Conditions table. And this does not work.

cur_frm.cscript.custom_tc_name = function(doc) {
cur_frm.set_value(“tc_text”, cur_frm.add_fetch(“tc_name”,“terms”,“tc_text”));
}

It would be great appreciated.

Thank you.

Rgds,
Will

When you hard code the default value using :

cur_frm.cscript.custom_tc_name = function(doc) {
default_value = "Terms and Conditions";
cur_frm.set_value("tc_text", default_value);
} 

Here you have to setup the title of the terms and conditions file created in terms and conditions list. The text is automatically fetched in the table below in the field terms.