Hello,
This function is called from a hook. It passes a doc of type “Fees”. It is supposed to extract some of the attributes in Fee and use it to create a new doc of type “Sales Invoice”.
I am stuck at assigning doc.components from “Fees” to items in the new “Sales Invoice”. Any pointers will be appreciated. pls note, doc.components has fields fees_category and amount that I want to copy to ‘description’ and ‘amount’ in “Sales Invoice → items” respectively.
def NewFeeInv2(doc, method):
feeinv = frappe.get_doc({
'doctype': "Sales Invoice",
'naming_series': 'SINV-',
'posting_date': doc.creation,
'base_grand_total': float(doc.total_amount),
"items":[{????????}]
})