add_fetch Pricing Rule field in the Sales Order form

Dear Experts,

I am trying to retrieve data on a custom field that I have created in the Pricing Rule form. The field name is "rebate". I have also created the "rebate" field in the Sales Order Item doctype.

I have tried the following custom script both in the Sales Order doctype and Sales Order Item doctype:

cur_frm.add_fetch('pricing_rule','rebate','rebate');

This doesn't work.

Anyone with any advice?

Thank you very very much.


Javier



  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/c2245949-6308-4220-8e97-86fc52b83635%40googlegroups.com.

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


On 29-Sep-2014, at 3:50 pm, Javier Wong <bo...@gmail.com> wrote:

Dear Experts,

I am trying to retrieve data on a custom field that I have created in the Pricing Rule form. The field name is "rebate". I have also created the "rebate" field in the Sales Order Item doctype.

I have tried the following custom script both in the Sales Order doctype and Sales Order Item doctype:

cur_frm.add_fetch('pricing_rule','rebate','rebate');

This doesn't work.

Anyone with any advice?

Thank you very very much.

Why don't you share your repo first?



Javier




  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/c2245949-6308-4220-8e97-86fc52b83635%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/C3109ACA-EE95-48CD-B26A-F3142262366E%40gmail.com.

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

Actually I have been trying to share my repo for a long time but I have some problems. I really am clueless about git and how to use it.

I have an existing installation which I want to use as the repo for sharing. Can you guide me please as to how I can do this?

Thank you very very much.

  1. Please be kind and don’t send large attachments
  2. For issues, features requests use Issues · frappe/erpnext · GitHub

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/66cbe0db-dcfd-4380-94c1-122a6d97037d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

It would be better to get known the tools on hand first to work with erpnext ,it requires quite a lot of web developer knowledge.

在 2014年9月29日星期一UTC+8下午8时26分01秒,Javier Wong写道:
Actually I have been trying to share my repo for a long time but I have some problems. I really am clueless about git and how to use it.

I have an existing installation which I want to use as the repo for sharing. Can you guide me please as to how I can do this?

Thank you very very much.


  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/b2d08fea-b226-4573-ad4f-036209384e1a%40googlegroups.com.

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

I recommend you spend a few minutes to pickup git. It will be a worthwhile investment if you plan being a developer :)

http://git-scm.com/documentation

best,
Rushabh



@rushabh_mehta

On 29-Sep-2014, at 5:56 pm, Javier Wong <bo...@gmail.com> wrote:

Actually I have been trying to share my repo for a long time but I have some problems. I really am clueless about git and how to use it.

I have an existing installation which I want to use as the repo for sharing. Can you guide me please as to how I can do this?

Thank you very very much.

--
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/66cbe0db-dcfd-4380-94c1-122a6d97037d%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/2FF83980-529D-4682-AD00-54468F9B18A5%40gmail.com.

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

Hi Rushabh,

I think I have the repo setup at GitHub - javierwonghf/erpnext: Open Source ERP built for the Web. Uses Python, MariaDB..

Any chance you can see the Custom Script that I am attempting to create for the Sales Order doctype?

Thank you very very much.

Javier

Where should I look?

Dear Rushabh,

  1. I created a Custom “rebate” field in the Pricing Rule doctype (Please see first image)
  2. I created a Custom “rebate” field in the Sales Order Item doctype (Please see second image)
  3. Then I created a custom script to fetch the rebate stored once the Pricing Rule is triggered
  4. The “cur_frm.add_fetch(‘pricing_rule’,‘rebate’,‘rebate’);” doesn’t fetch as desired

If I am not wrong, custom client side scripts are stored in the DB?

Thanks very much.

Pricing Rule

Sales Order Item

https://gist.github.com/bohlian/28617557aa494e654fb3

add_fetch should work as it is. did you clear cache before trying?

check your network tab for the validate_link request and see if your value is being fetched.

Yes, cleared cache. Based on the network request the value is not returned (as per attached image).

FYI, this works: I tried “cur_frm.add_fetch(‘item_code’,‘lead_time_days’,‘rebate’);” and the value is returned.

I tried fetching other fields in the Pricing Rule DocType such as max_qty and it also doesn’t work. Only difference I can think of is that item_code is keyed in by a user whereas pricing_rule is filled in by the system.

This is the item query. Price list is a bit tricky, because it gets fetched along with the Item.

See this file for item fetching behaviour