Custom Scripts
การดึงค่าจาก Master
การดึงค่าจาก Master
เพื่อดึงค่าของลิงก์เมื่อเลือก ให้ใช้เมธอด add_fetch
add_fetch(link_fieldname, source_fieldname, target_fieldname)
ตัวอย่าง
ให้สมมติว่าคุณได้สร้างฟิลด์ที่กำหนดเอง VAT ID (vat_id) ใน Customer และ Sales Invoice และต้องการมั่นใจว่าค่านี้จะถูกอัปเดตทุกครั้งที่คุณเลือก Customer ใน Sales Invoice
เพื่อกำหนดค่านี้ ใน Custom Script ของ Sales Invoice คุณสามารถเพิ่มบรรทัดนี้:
cur_frm.add_fetch('customer','vat_id','vat_id')