I am trying to understand Custom Scripts and doing so started to study some examples given in the Documentation
i.e. this one
Custom Scripts / Fetch Values From Master
Custom Script for Fetching Values From Master
To pull a value of a link on selection, use the
add_fetch
method.add_fetch(link_fieldname, source_fieldname, target_fieldname)
Example
Let’ say you have created a Custom Field VAT ID (
vat_id
) in Customer and Sales Invoice and want to make sure that this value gets updated every time you select a Customer in a Sales Invoice.To configure this, in the Sales Invoice Custom Script, you can add this line:
cur_frm.add_fetch('customer','vat_id','vat_id')
now the abstract add_fetch(link_fieldname, source_fieldname, target_fieldname)
looks not quite correct to me.
comparing it to the concrete example
abstract:
add_fetch(link_fieldname, source_fieldname, target_fieldname)
concrete:cur_frm.add_fetch('customer','vat_id','vat_id')
looks to me as if the abstract should be
add_fetch(doctype, source_fieldname, target_fieldname)
customer
is not a link_fieldname
, but the doctype
you are fetching the data from in this example. Isn’t that so?