Files
upstream-frappe-crm/crm/public/js/erpnext_sales_order_customer.js
upstream-mirror db69de1c11
Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1m13s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 6s
Server / Tests (frappe ${{ matrix.frappe-branch }}) (push) Has been skipped
Server / Resolve frappe matrix (push) Failing after 1s
Frontend / Lint (push) Failing after 1s
Frontend / Production Build (push) Failing after 1s
Server / Coverage Wrap Up (push) Has been skipped
Frontend / Coverage Wrap Up (push) Has been skipped
snapshot of https://github.com/frappe/crm.git (develop, 2026-09-18; blobs > 131072B omitted)
2026-09-18 01:36:01 +05:00

18 lines
671 B
JavaScript

frappe.ui.form.on('Sales Order', {
refresh(frm) {
// When a Sales Order is created from a CRM Deal quotation that has no
// customer yet, create/fetch the customer and fill the mandatory field.
if (frm.doc.docstatus !== 0 || frm.doc.customer || frm.__crm_customer_checked) return
const item = (frm.doc.items || []).find((i) => i.prevdoc_docname)
if (!item) return
frm.__crm_customer_checked = true
frappe.call({
method: 'crm.fcrm.doctype.erpnext_crm_settings.erpnext_crm_settings.check_customer_for_quotation',
args: { quotation: item.prevdoc_docname },
callback: (r) => {
if (r.message) frm.set_value('customer', r.message)
},
})
},
})