{
	"name": "table/manager/product/product_material.json",
	"table_name": "product_material",
	"table_prefix": "prma",
	"save_script": [],
	"field": [{
			"type": "varchar",
			"length": 20,
			"name": "record_type"
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "product_id",
			"foreign_key": {
				"field": "product_id",
				"link_type": "prevent delete",
				"table": "product"
			}
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "material_id",
			"foreign_key": {
				"field": "product_id",
				"link_type": "prevent delete",
				"table": "product"
			}
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "stock_event_id"
		},
		{
			"name": "row_number",
			"type": "integer"
		},
		{
			"name": "work_phase_number",
			"type": "integer"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "production_lot"
		},
		{
			"name": "product_material_state",
			"type": "integer"
		},
		{
			"name": "amount",
			"type": "double"
		},
		{
			"type": "varchar",
			"length": 20,
			"name": "unit"
		},
		{
			"name": "cost_price",
			"type": "double"
		},
		{
			"name": "profit_multiplier",
			"type": "double"
		},
		{
			"name": "sales_price",
			"type": "double"
		},
		{
			"name": "description",
			"type": "text"
		},
		{
			"name": "info",
			"type": "text"
		},
		{
			"name": "json_data",
			"type": "jsonb"
		}
	],
	"constraint": {
		"save": {
			"allow": [{
				"field": "prma_material_id",
				"message": "Field '%s' may not be empty",
				"code": [
					[
						"prma_material_id",
						"<>",
						""
					]
				]
			}]
		}
	},
	"extra_field": [{
			"type": "double",
			"name": "json_data.amount_in_unit_2"
		},
		{
			"type": "double",
			"name": "json_data.calc_sales_price__unit"
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "json_data.customer_project"
		},
		{
			"type": "integer",
			"name": "json_data.firm_id"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "json_data.modifier_id"
		},
		{
			"type": "double",
			"name": "json_data.net_amount"
		},
		{
			"type": "double",
			"name": "json_data.net_amount__design_unit_2"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "json_data.parcel_code"
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "json_data.project_id"
		},
		{
			"type": "varchar",
			"length": 120,
			"name": "json_data.transfer_id"
		},
		{
			"type": "integer",
			"name": "json_data.transfer_state"
		},
		{
			"type": "varchar",
			"length": 20,
			"name": "json_data.unit_2"
		},
		{
			"type": "varchar",
			"length": 60,
			"name": "json_data.work_number"
		},
		{
			"type": "double",
			"name": "json_data.cost_price_in_stock_unit"
		},
		{
			"type": "double",
			"name": "json_data.cost_price_total"
		},
		{
			"type": "varchar",
			"length": 20,
			"name": "json_data.cover__inside"
		},
		{
			"type": "double",
			"name": "json_data.extra_percentage"
		},
		{
			"type": "double",
			"name": "json_data.height"
		},
		{
			"type": "integer",
			"name": "json_data.kind"
		},
		{
			"type": "integer",
			"name": "json_data.material_owner"
		},
		{
			"type": "double",
			"name": "json_data.pages__paper"
		},
		{
			"type": "double",
			"name": "json_data.pieces"
		},
		{
			"type": "double",
			"name": "json_data.quantity__unit_2"
		},
		{
			"type": "double",
			"name": "json_data.quantity__unit_without_ex"
		},
		{
			"type": "double",
			"name": "json_data.sales_price_total"
		},
		{
			"type": "double",
			"name": "json_data.total_quantity"
		},
		{
			"type": "double",
			"name": "json_data.total_quantity_2"
		},
		{
			"type": "double",
			"name": "json_data.width"
		},
		{
			"type": "double",
			"name": "json_data.working_allowance"
		},
		{
			"type": "varchar",
			"length": 60,
			"name": "json_data.work__position_num_id"
		},
		{
			"type": "double",
			"name": "json_data.work_need_amount"
		}
	],
	"calculated_field": [{
		"name": "json_data.amount_in_unit_2",
		"type": "double"
	}],
	"field_change": [{
		"name": "product_material_state",
		"old_name": [
			"record_state"
		]
	}]
}