Custom field in the Against Sales invoice field

Hi
I have one custom field in Sales Invoice, I need this field also to come in the aginst Sales Invoice field as an option along with Sales invoice name,date of creation, customer name, fiscal year and total amount in journal Entries table in Journal Voucher.

Thanks

Khalid,

Please share screenshots (via imgur) of:

  • Field in Sales Invoice which needs to be fetched in the Journal Voucher.
  • Field in Journal Voucher, which needs to have data updated from Sales Invoice custom field.
  • Other fields you want updated in the Journal Voucher, based on data in Sales Invoice.

Hi Umair,
I shared you three images. The third image clarify my need as discussed in my last inquiry (displaying also FS NO in the selection options)
http://imgur.com/2ulvLco.jpg
http://imgur.com/OmVgyvH.jpg

Thanks

hi,

I think you are missing something. The FS No is a field on the JV main table whereas the against Sales Invoice is being pulled in the JV detail.

I would suggest the following,

Make the new custom field FS No in the JV Detail and then add this to your JV custom script:

cur_frm.add_fetch('against_invoice','fs_no','fs_no');

This should work, the only thing is that FS No would be in the JV Details table and not in the JV main since there could be a case when you have multiple against Sales Invoices in a JV.

Let me know if it worked.

Hello Adityaduggal,
Thanks for your quick respnse, appreciate that. Forget about the above two pictures for the time being and let us concentrate on the third one. Very simple, i need my custom field value(alrady on the Sales Invoice) to come as a selection options like the others name ‘SINV-00067’,2014-07-25,2014-09-08,ICAP ETHIOPIA - LITP,2014-2015,297000,FS000258(my custom field value from sales invoice)

Thanks

I think that the code I have mentioned for the custom script should fetch the fs_no. But if it not fetching then you would have to ensure that the field name for “Last Invoice FS No” on JV detail should be fs_no only.

Hi Aditya,
No, Sorry, i think we are not on the same track, forget the “Last Invoice FS No” it is there for other purpose. I made this one clear in my last question. How to bring the FS No value as an option for selection in the Against Sales Invoice field. Sorry for the misaunderstanding and Thanks for your rapid response.
Thanks

Go to Setup -> Customize Form, select Sales Invoice form and then add fs_no in Search Fields value. Then clear cache and check.

Thanks Nabin it is comming,
ok now, how about transfering custom field value from sales invoice(parent) in to JV(parent)
Thanks

I added also a custom field on the search field of Delivery note to be filtered by that, like i did for the sales invoice but it is not coming on the stock entry during sales return.
Does it not work for all or what?

Why are you adding that custom field in JV parent form? It will not work in case there are multiple invoice linked in the JV. Instead you should add the custom field in JV child table. And in that case, the steps mentioned by @adityaduggal should work perfectly.

If you want the custom field in the parent form, add_fetch method will not work, you have to write some server side script (using python) to fetch and set the value.

Result for Delivery Note link-field in Sales Return is over-written using some code. In this case, changing “Search Fields” will not work.

To modify the result you have to change the function https://github.com/frappe/erpnext/blob/develop/erpnext/stock/doctype/stock_entry/stock_entry.py#L641

Hi Nabin,

do i have to modify this part to to search by the FS NO also

[Ref DocType, [Item tables’ parentfields]]

	"delivery_note_no": ["Delivery Note", ["delivery_note_details", "packing_details"]],

Thanks

No, you have to modify this function:

def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters):
    conditions = ""
    if doctype == "Sales Invoice":
        conditions = "and update_stock=1"

    return frappe.db.sql("""select name, customer, customer_name
        from `tab%s` where docstatus = 1
            and (`%s` like %%(txt)s
                or `customer` like %%(txt)s) %s %s
        order by name, customer, customer_name
        limit %s""" % (doctype, searchfield, conditions,
        get_match_cond(doctype), "%(start)s, %(page_len)s"),
        {"txt": "%%%s%%" % txt, "start": start, "page_len": page_len},
        as_list=True)

You need to change the select query and have to select fs_no column as well.

Thanks Nabin,
I did it on my test server and its working fine but it is not on my live server. i edited similar file but with no reflection. Am i editeng the wrong file or what?, here is the path…
home/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py
I saved and cleared cache
Thanks