Custom field value = formula result

Is this possible without scripting? Create a custom field that automatically pre-populates its default value based on the result of a formula that uses other field values as input?

The specific idea I have is to set a default expected delivery date in sales order based on the posting date, wherein default value = Posting Date + X days

Taking it one step forward even more, the value of X could be customized by customer or customer type (now this will likely require more work on back end).



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.

Currently there is no way to define a formula without custom client script. But the custom script is pretty simple, you can look at the following example.
https://github.com/webnotes/wnframework/wiki/Client-side-scripting#assign-expected-delivery-date-as-x-days-after-sales-order-date

If you want to fetch days from customer master, that kind of example is also there in the above link.

On 18-Sep-2013, at 5:28 AM, lxnow wrote:

Is this possible without scripting? Create a custom field that automatically pre-populates its default value based on the result of a formula that uses other field values as input?

The specific idea I have is to set a default expected delivery date in sales order based on the posting date, wherein default value = Posting Date + X days

Taking it one step forward even more, the value of X could be customized by customer or customer type (now this will likely require more work on back end).



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.

That rocks. The correct code using default fields is:

// below is for setting default expected delivery date
cur_frm.cscript.custom_sales_order_date = function(doc) {
    cur_frm.set_value("delivery_date", wn.datetime.add_days(doc.transaction_date, 3));
}

Will look into linking it by customer master later.

On Wednesday, September 18, 2013 12:46:32 PM UTC+8, Nabin Hait wrote:
Currently there is no way to define a formula without custom client script. But the custom script is pretty simple, you can look at the following example.

If you want to fetch days from customer master, that kind of example is also there in the above link.

On 18-Sep-2013, at 5:28 AM, lxnow wrote:

Is this possible without scripting? Create a custom field that automatically pre-populates its default value based on the result of a formula that uses other field values as input?

The specific idea I have is to set a default expected delivery date in sales order based on the posting date, wherein default value = Posting Date + X days

Taking it one step forward even more, the value of X could be customized by customer or customer type (now this will likely require more work on back end).



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.