In face this issue creating the Payment Entry, when I clicked the ‘Mode of Payment’ field it shows the options in English which is the original names of them. But they should be translated in Turkish. When I save the document it still shows the English version but when the document is submitted, the Turkish version of the “Mode of Payment” options appear. I tried to change them using Form Scripts like below but it threw an error something like “The source you search does not exist.”
frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Mode of Payment",
fields: ["name"],
},
callback: function (response) {
if (response && response.message) {
const mode_of_payments = response.message;
let translated_options = mode_of_payments.map((mop) => {
return {
label: __(mop.name),
name: mop.name,
};
});
frm.fields_dict["mode_of_payment"].df.options =
translated_options;
frm.refresh_field("mode_of_payment");
}
},
});