I’m trying to create a print format for sales invoice. For this purpose, I need to show some values of a child table.
Let me explain my use case in detail. I have a child table “Vehicle Data” in Customer DocType. For each customer, I will add details of their vehicle. Now when I print the sales invoice I need the 3 fields from vehicle details corresponding to the customer in the invoice.
What I did now is I used custom html block and used jinja template inside the html block.
This is the code that I used to fetch vehicle details: frappe.db.get_value(“Vehicle Data”, doc.customer, vehicle_number ). This gives me the value. But what I noticed is that whenever I change the Vehicle details in any other customer document or create a new customer with new vehicle details, and refresh my older sales invoice, the new vehicle details are loaded into the form.
How do I only select the vehicle details corresponding to the customer I have chosen in the invoice?