{
	"name": "form/nc/project-material/save-purchase-order.json",
	"save": [
		{
			"table": "order",
			"record_type": "purchase",
			"row_table": [{ "table": "order_row" }],
			"aggregate_field": "company_id",
			"row_number_field": [
				{
					"field": "ordr.row_number",
					"start_value": 0
				}
			]
		}
	],
	"run_script": [
		{
			"table": "order_row",
			"record_type": "purchase",
			"find_linked_record": ["ordr.order_id"],
			"init_new_record": 1,
			"script_field": ["ordr.product_id", "ordr.order_amount"]
		},
		{
			"table": "order",
			"record_type": "purchase",
			"script_field": ["ord.company_id"],
			"up_calculate": 1
		}
	]
}
