Changes for Recurring PO/PI

Changes made to Purchase Order/Purchase Invoices referring pull request https://github.com/frappe/erpnext/pull/2109 - which was for Sales Orders/Sales Invoices.

This would add a feature to set Purchase Orders/Invoices to recur periodically.

Has been tested locally, please review and let me know if any changes are requried.
Move these 2 functions to transaction.js (common for both sales and purchase cycle) so that these functions can be removed from:
1. Sales Invoice
1. Sales Order
1. Purchase Invoice
1. Purchase Order