Different Letterhead for Different Companies

Dear Team,

I have 2 companies. Company A & Company B. I created 2 Letter head for each company Sales invoice. And on the company details section, set these as default letterhead. However when i create a new invoice for Company A or Company B, it shows only one letterhead until i manually edit this. This is a fix for now. But on a long run, there is a chance for manual errors. How do we accomplish the letterheads being automatically selected based on the company selected?

Hi @craftspotae,

I think your problem will solve with the client/custom script.

Please apply and check it.

frappe.ui.form.on('Sales Invoice', {
     company(frm) {
         if (frm.doc.company == "Company A") {
             frm.doc.letter_head = "Letter Head A";
         else {
             frm.doc.letter_head = "Letter Head B";

Thank You!


This works ! Thank you