I have customized the Quotation Doctype by adding a field for the Customer GST Number. Additionally, I have customized the Customer Doctype and added a GST Number field to store this information.
Now, I want the GST Number to be automatically fetched in the Quotation when I select a Customer. How can I achieve this?
Any guidance examples would be greatly appreciated!
Thanks in advance.
You can use fetch from option.
- Go to Quotation customize it and select gst field and there is a a option fetch from here select doctype as Customer and select gst_number in select field then save
like this
1 Like
Thank you for reply
as I tryed to use fetch from in that the Customer doctype is not their
I have also tryed the different way as using defalt and option but it is also not working
In Quotation Customer field is there . Can you plz share screenshots
def set_gst_number(self):
if self.party_name and self.quotation_to == "Customer":
self.gst_number= frappe.db.get_value("Customer", self.party_name, "gst_number")
You can use this code to set gst_number. Same like customer name in quotation.
no i can’t write the code because it’s on the cloud and it is the shared cloud
then enable server script and add this code in server script doctype
it’s a sharable cloud and in shared cloud not allow to enable script
you can go through the follwing link for more information
https://frappecloud.com/docs/enable-server-script
frappe.ui.form.on('Quotation', {
refresh(frm) {
set_gst_number(frm);
}
});
function set_gst_number(frm) {
if (frm.doc.party_name && frm.doc.quotation_to === "Customer") {
frappe.db.get_doc("Customer", frm.doc.party_name)
.then(customer => {
frm.set_value("custom_gst_number", customer.custom_gst_number);
})
.catch(err => {
console.error("Error fetching customer:", err);
});
}
}
if possible use client script then
Thank you it is a good idea to use client script for cloud