For onchange trigger you should write the function with a little chnage:
cur_frm.cscript.amount_allocated_on_permit = function() {
cur_frm.set_value("total_amount_lawfully_used", 999);
}
You do not need to refresh field, as set_value function automatically refresh after setting the value.
cur_frm.cscript.custom_amount_allocated_on_permit = function() {
cur_frm.set_value("total_amount_lawfully_used", 999);
}
--
Note:
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/37a95255-0c6c-4e07-b4ff-237520a82815%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi,
We are somehow stuck with something that seems relatively easy.
Say we have 3 custom fields: AAA, BBB, and CCC, where CCC=AAA*BBB
We fail to trigger the recalculation if the user changes AAA or BBB
Robert
Description of Bas below:
The following is what we try to achieve.
The two numbers circled with red are multiplied in order to get the number in
green.
This works when the form loads (the 90 and the 7 are nicely fetched from
elsewhere, and the 630 is computed).
When the user changes the 90 to e.g. 100, we wish the 630 to be recomputed. As
this computation is "lightweight" (it is only a simple
multiplication), the nicest is to have this as the user types. In the worst
case, the recomputation can be done when the user leaves the "Amount
Allocated on Permit" text field by clicking on another field.
Note that the number recomputes if the user first clicks the "close"
arrow ( ^ ) and then re-selects the item to re-open it. But this is not good
enough because it causes misunderstandings as to which numbers are actually
used when creating the invoice. We want it to be interactive, recomputing this
simple multiplication on-the-fly, preferrably as the user types.
We have just tried the _custom option, but that also doesn't have the effect,
the number 630 stays as-is.
Thank you in advance for your kind support.
On 18/2/2014 14:04, Becht, R. (Robert, ITC) wrote:
Nabin Hait |
10:52 AM (3 hours ago) |
Use prefix "custom_" with the fieldname to call the trigger, it should work.
cur_frm.cscript.custom_amount_allocated_on_permit = function() {
cur_frm.set_value("total_amount_lawfully_used", 999);
}
- show quoted text -
--
Note:
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6591d0c2-f9c6-44af-b640-dbcc7bf777fd%40googlegroups.com.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/0af461a3-00fe-42be-a853-d1f05a93fdd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
Put the custom script for Sales Invoice doctype, not for Sales Invoice Item.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4d051527-a81d-4c9f-bb78-ecef9731e5b3%40googlegroups.com.
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/0af461a3-00fe-42be-a853-d1f05a93fdd5%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+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6f34b9cd-2244-4fc5-a57e-c3a0ca066b47%40googlegroups.com.
Dear Anand,Is it possible to set the field to read only programmatically? I have a custom field that is of Currency type called "discount_amount" and I want to make it read only after say the pricing rule is triggered. Can I run something like "frappe.model.set_df_property(cdt, cdn, "discount_amount", "read_only", 0);"? It currently doesn't work - perhaps my syntax is wrong....Appreciate any help. Thank you very much....The current customer script that I am using "all works except setting the field to read only"cur_frm.cscript.pricing_rule = function(doc, cdt, cdn) {var d = locals[cdt][cdn];result_value = d.price_list_rate - d.rate;frappe.model.set_value(cdt, cdn, "discount_amount", result_value);frappe.model.set_df_property(cdt, cdn, "discount_amount", "read_only", 0);
}
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e4ac88b1-784a-4483-8899-5324dbaf98e9%40googlegroups.com.