Fix portal user linking: use updateResource instead of set_value for child table

set_value doesn't work for child tables like portal_users. Use
updateResource (PUT /api/resource/Customer) which handles it correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-29 01:48:05 -05:00
parent 02d2415d7a
commit 28b407eea6

View file

@ -1225,11 +1225,8 @@ export async function handlePaymentComplete(
erpCustomer = custResult.customerName;
// Link portal user to Customer so portal shows their orders
try {
await callMethod("frappe.client.set_value", {
doctype: "Customer",
name: erpCustomer,
fieldname: "portal_users",
value: [{ user: custEmail }],
await updateResource("Customer", erpCustomer!, {
portal_users: [{ user: custEmail }],
});
} catch { /* non-fatal — may already be linked */ }
} catch { /* non-fatal */ }