mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
1.0 KiB
1.0 KiB
Parent Child Relationship
All documents can have child documents, identified by the Table
field.
Though child documents have their own DocType and database table, but are not to handled or viewed on their own. FrappeJS will automatically load child documents along with the parent when you use the frappe.getDoc
method.
Example
A sample parent-child records looks like this:
{
doctype: "Invoice",
customer: "Harry Potter",
items: [
{
item: "Wand",
qty: 1,
rate: 300,
amount: 300
},{
item: "Invisibility Cloak",
qty: 1,
rate: 3000,
amount: 3000
}
]
}
Child Properties
Child documents have special properties that define their relationship to their parent
parent
: name of the parentparenttype
: DocType of the parentparentfield
: Field in the parent that links this child to itidx
: Sequence (row)
These properties are maintained in the table automatically by FrappeJS