{
  "name": "save/manager/order/project_material/save_purchase_order.json",
  "database": "4d",
  "save": [
    {
      "table": "ord",
      "record_type": "purchase",
      "row_table": [
        "ordr"
      ],
      "aggregate_field": "ord_company_id",
      "row_number_field": [
        {
          "field": "ordr_row_number",
          "start_value": 0
        }
      ]
    }
  ],
  "run_script": [
    {
      "table": "ordr",
      "find_linked_record": [
        "ordr_order_id"
      ],
      "init_new_record": 1,
      "script_field": [
        "ordr_product_id",
        "ordr_order_amount"
      ]
    },
    {
      "table": "ord",
      "script_field": [
        "ord_company_id"
      ],
      "up_calculate": 1
    }
  ]
}
