Dear all,
in the Sales Order there is a ‘Terms and Conditions’ section which is good. But what we would need is to have a ‘Terms and Conditions’ section in the Customer Master. And from there it should get defaulted to the Sales Order (dependent on which Customer was selected in the Sales Order).
Usually Terms and Conditions are agreed with each Customer, and from there it should get reflected on every Sales Transactions. Is there any way to achieve such thing with the default system?
Thank you and best regards,
David
1 Like
Hi @David_Stegnitz
You could achieve this with custom script
1 Like
Thank you @srinivasragav
Still anyone would have a suggestion/workaround without having to customize/write scripts? Or might this be planned for one of the future releases?
Thanks, David
1 Like
Hi @David_Stegnitz ,
Create a custom field in the customer master and name it as " tc_name "(type - link field) , link it to terms and conditions master . And paste this code in the sales order custom script location !!
cur_frm.add_fetch('customer_name','tc_name','tc_name');
{
cur_frm.add_fetch('tc_name','tc_name');
frappe.ui.form.on("Sales order", "refresh", function(frm, doctype, name)
{
cur_frm.get_field("tc_name").get_query = function(doc, cdt, cdn)
{
var item = frappe.get_doc(cdt, cdn);
var c = " ";
if (item.customer_name) c=item.customer_name ;
return { filters: {'customer_name': c}}
}
}
);
}
4 Likes
Thanks a lot @srinivasragav, I will try as you suggested and will update the post after.
David
1 Like
Good luck . You are welcome .