How to add rows to Items table in Opportunity by script

17 views
Skip to first unread message

Chris Horton

unread,
Aug 19, 2014, 2:02:35 PM8/19/14
to erpnext-dev...@googlegroups.com
I'm using ERPNext 3.6.1. If I wanted to add a new row to the Items table in Opportunity with certain Item Code already determined, via a script, how would I do this?

I'm currently using a very hackish solution to get a new row started by using $('.grid-add-row').trigger('click'); in opportunity.js, but even then I do not know how to set the Item Code field automatically to the desired value.

Thanks!

Chris Horton

unread,
Aug 19, 2014, 2:11:51 PM8/19/14
to erpnext-dev...@googlegroups.com
Actually, I just found I could follow that up with $('input[data-fieldname="item_code"]').val('Item code here'); to get the desired effect. Still, if there's a cleaner way of doing this, feel free to let me know. :)
Reply all
Reply to author
Forward
0 new messages