I am trying to automatically create item child entries for Stock Entry DocType in ERPNext, but I am unable to make it for the child table I want.
It works normally for other child tables of the same parent: I am able to get “additional_costs” which is a child table. (DocType Landed Cost Taxes and Charges)
doc = frappe.get_doc("Stock Entry", stock_entries[0].name).as_dict()
print(doc.additional_costs)
> [{'name': 'atcampanfd', 'owner': 'vesta@etuneworks.com', 'creation': datetime.datetime(2025, 1, 27, 11, 22, 29, 248470), 'modified': datetime.datetime(2025, 1, 27, 11, 25, 44, 9781), 'modified_by': 'vesta@etuneworks.com', 'docstatus': 1, 'idx': 1, 'expense_account': 'Expenses Included in Valuation - ETUNE', 'account_currency': 'SGD', 'exchange_rate': 1.0, 'description': 'Operating Cost as per Work Order / BOM', 'amount': 20.0, 'base_amount': 20.0, 'parent': 'MAT-STE-2025-00004', 'parentfield': 'additional_costs', 'parenttype': 'Stock Entry', 'doctype': 'Landed Cost Taxes and Charges'}]
However, if I try to get a different child table, “items” (Doctype “Stock Entry Detail”), I instead receive a pointer? which I am unable to access either.
print(doc.items)
> <built-in method items of _dict object at 0x7f7e3c13f380>
print(doc.items[0])
> Object { exception: "TypeError: 'builtin_function_or_method' object is not subscriptable", exc_type: "TypeError", _exc_source: "Server Script", exc: (1) […], _server_messages: '["{\\"message\\": \\"Searching for stock entries on \\\\\\"2025-01-27\\\\\\"\\", \\"title\\": \\"Message\\"}"]' }