# DocType Mapper, Indent-Purchase Order
[

	# These values are common in all dictionaries
	{
		'creation': '2010-08-08 17:09:34',
		'docstatus': 0,
		'modified': '2011-09-15 15:04:42',
		'modified_by': 'Administrator',
		'owner': 'Administrator'
	},

	# These values are common for all Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'name': '__common__',
		'parent': 'Indent-Purchase Order',
		'parentfield': 'table_mapper_details',
		'parenttype': 'DocType Mapper'
	},

	# These values are common for all Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'map': 'Yes',
		'name': '__common__',
		'parent': 'Indent-Purchase Order',
		'parentfield': 'field_mapper_details',
		'parenttype': 'DocType Mapper'
	},

	# These values are common for all DocType Mapper
	{
		'doctype': 'DocType Mapper',
		'from_doctype': 'Indent',
		'module': 'Buying',
		'name': '__common__',
		'ref_doc_submitted': 1,
		'to_doctype': 'Purchase Order'
	},

	# DocType Mapper, Indent-Purchase Order
	{
		'doctype': 'DocType Mapper',
		'name': 'Indent-Purchase Order'
	},

	# Field Mapper Detail
	{
		'checking_operator': '=',
		'doctype': 'Field Mapper Detail',
		'from_field': 'company',
		'match_id': 0,
		'to_field': 'company'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'parenttype',
		'match_id': 1,
		'to_field': 'prevdoc_doctype'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'parent',
		'match_id': 1,
		'to_field': 'prevdoc_docname'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'name',
		'match_id': 1,
		'to_field': 'prevdoc_detail_docname'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'uom',
		'match_id': 1,
		'to_field': 'stock_uom'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval:flt(1)',
		'match_id': 1,
		'to_field': 'conversion_factor'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)',
		'match_id': 1,
		'to_field': 'stock_qty'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)',
		'match_id': 1,
		'to_field': 'qty'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_table': 'Indent',
		'match_id': 0,
		'reference_key': 'prevdoc_docname',
		'to_table': 'Purchase Order',
		'validation_logic': 'docstatus = 1'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_field': 'indent_details',
		'from_table': 'Indent Detail',
		'match_id': 1,
		'reference_doctype_key': 'prevdoc_doctype',
		'to_field': 'po_details',
		'to_table': 'PO Detail',
		'validation_logic': 'qty > ifnull(ordered_qty,0) and docstatus =1'
	}
]