Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/accounts/doctype/loan/__init__.py b/accounts/doctype/loan/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/accounts/doctype/loan/__init__.py
+++ /dev/null
diff --git a/accounts/doctype/loan/loan.js b/accounts/doctype/loan/loan.js
deleted file mode 100644
index 5a45362..0000000
--- a/accounts/doctype/loan/loan.js
+++ /dev/null
@@ -1,54 +0,0 @@
-$.extend(cur_frm.cscript, {
-	Generate: function(doc, dt, dn) {
-		cur_frm.cscript.clear_installments(doc);
-		for(var i=0; i< doc.no_of_installments; i++) {
-			d = LocalDB.add_child(doc, 'Loan Installment', 'installments');
-			d.amount = doc.loan_amount / doc.no_of_installments;
-			d.due_date = dateutil.add_months(doc.start_date, i+1);
-		}
-		cur_frm.refresh();
-	},
-/*	submit:function(doc){
-		data=doc.get_values();
-
-		data['']=
-		$c_obj(make_doclist(dt,dn),'loan_post',data,function(){});
-	},*/
-	refresh: function(doc) {
-		cur_frm.cscript.hide_show_buttons(doc);
-	},
-	hide_show_buttons: function(doc) {
-		if(doc.docstatus==0) {
-			hide_field('Installment Reciept'); unhide_field('Generate');
-		} else if (doc.docstatus==1) {
-			unhide_field('Installment Reciept');hide_field('Generate');
-		}
-	},
-	clear_installments: function(doc) {
-		$.each(getchildren('Loan Installment', doc.name, 'installments', 'Loan'),
-			function(i, d) {
-				LocalDB.delete_doc('Loan Installment', d.name);
-			}
-		)
-	},
-	'Installment Reciept': function(doc, dt, dn) {
-		var d = new wn.widgets.Dialog({
-			width: 500,
-			title: 'Add a new payment installment',
-			fields: [
-				{fieldtype:'Data', label:'Cheque Number', fieldname:'cheque_number', reqd:1},
-				{fieldtype:'Date', label:'Cheque Date', fieldname:'cheque_date', reqd:1},
-				{fieldtype:'Link', label:'Bank Account', fieldname:'bank_account', reqd:1, options:'Account'},
-				{fieldtype:'Button', label:'Update',fieldname:'update'}
-			]
-		})
-		d.show();
-		d.fields_dict.update.input.onclick = function() {
-			var data = d.get_values();
-
-			if(data) {
-				$c_obj(make_doclist(dt,dn),'loan_installment_post',data,function(){cur_frm.refresh(); d.hide();});
-			}
-		}
-	}
-})
diff --git a/accounts/doctype/loan/loan.py b/accounts/doctype/loan/loan.py
deleted file mode 100644
index 9f0bcb5..0000000
--- a/accounts/doctype/loan/loan.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import webnotes
-from webnotes.model.doc import make_autoname, Document, addchild
-from webnotes import msgprint
-from webnotes.utils import get_defaults
-import json
-from accounts.utils import post_jv
-sql = webnotes.conn.sql
-
-class DocType:
-	def __init__(self, doc, doclist):
-		self.doc, self.doclist = doc, doclist
-
-	def autoname(self):
-		"""
-			Create Loan Id using naming_series pattern
-		"""
-		self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
-
-	def loan_post(self):
-		data['voucher_type']='Loan Issue'
-		data['naming_series']='JV'
-		data['fiscal_year'] = get_defaults()['fiscal_year'] # To be modified to take care
-		data['company'] = get_defaults()['company']
-		data['debit_account'] = self.doc['receivable_account']
-		data['credit_account'] = self.doc['account']
-		data['amount'] = self.doc.loan_amount
-		jv_name=post_jv(data)
-
-	def loan_installment_post(self, args):
-		"""
-			Posts the loan receipt into Journal Voucher
-		"""
-		next_inst = sql("select amount,name from `tabLoan Installment` where parent=%s and ifnull(cheque_number,'')='' order by due_date limit 1",self.doc.name)
-
-		data = json.loads(args)
-		data['voucher_type']='Loan Receipt'
-		data['naming_series']='JV'
-		data['amount']=next_inst[0][0]
-		data['debit_account']=data.get('bank_account')
-		data['credit_account']=self.doc.account
-		data['fiscal_year']=get_defaults()['fiscal_year']
-		data['company']=get_defaults()['company']
-		jv_name=post_jv(data)
-
-		sql("update `tabLoan Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv_name,next_inst[0][1]))
-
-		self.doclist = [Document(d.doctype, d.name) for d in self.doclist]
-
diff --git a/accounts/doctype/loan/loan.txt b/accounts/doctype/loan/loan.txt
deleted file mode 100644
index 001e1d3..0000000
--- a/accounts/doctype/loan/loan.txt
+++ /dev/null
@@ -1,172 +0,0 @@
-# DocType, Loan
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-15 10:35:26',
-		'docstatus': 0,
-		'modified': '2011-07-18 12:12:19',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1310963215',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 15
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Loan',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Loan',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'Accounts User'
-	},
-
-	# DocType, Loan
-	{
-		'doctype': 'DocType',
-		'name': 'Loan'
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Naming Series',
-		'options': '\nLOAN',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'account',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Account',
-		'options': 'Account',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'receivable_account',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'Receivable Account',
-		'options': 'Account'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'invoice',
-		'fieldtype': 'Link',
-		'idx': 4,
-		'label': 'Invoice',
-		'options': 'Receivable Voucher',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'loan_amount',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Loan Amount',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'start_date',
-		'fieldtype': 'Date',
-		'idx': 6,
-		'label': 'Start Date',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'no_of_installments',
-		'fieldtype': 'Int',
-		'idx': 7,
-		'label': 'No of Installments',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 8,
-		'label': 'Generate',
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'installments',
-		'fieldtype': 'Table',
-		'idx': 9,
-		'label': 'Installments',
-		'options': 'Loan Installment'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 10,
-		'label': 'Installment Reciept'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/loan/test_loan.py b/accounts/doctype/loan/test_loan.py
deleted file mode 100644
index 4e72559..0000000
--- a/accounts/doctype/loan/test_loan.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import unittest
-import webnotes
-from webnotes.model.code import get_obj
-
-class TestScheduleGeneartion(unittest.TestCase):
-	def setUp(self):
-		webnotes.conn.begin()
-		# create a mock loan
-		self.loan = get_obj('Loan', 'LOAN00001')
-		
-	def test_generation(self):
-		"test the genaration of loan installments"
-		self.loan.generate()
-		self.assertEqual(self.loan.get_installment_total(), self.loan.doc.loan_amount)
-		
-	def tearDown(self):
-		webnotes.conn.rollback()
diff --git a/accounts/doctype/loan_installment/__init__.py b/accounts/doctype/loan_installment/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/accounts/doctype/loan_installment/__init__.py
+++ /dev/null
diff --git a/accounts/doctype/loan_installment/loan_installment.txt b/accounts/doctype/loan_installment/loan_installment.txt
deleted file mode 100644
index f729e34..0000000
--- a/accounts/doctype/loan_installment/loan_installment.txt
+++ /dev/null
@@ -1,111 +0,0 @@
-# DocType, Loan Installment
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-15 10:36:42',
-		'docstatus': 0,
-		'modified': '2011-07-15 15:48:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 4
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Loan Installment',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Loan Installment
-	{
-		'doctype': 'DocType',
-		'name': 'Loan Installment'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'idx': 1,
-		'label': 'Amount',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'due_date',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Due Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_number',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Cheque Number',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_date',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'Cheque Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'deposit_date',
-		'fieldtype': 'Date',
-		'idx': 5,
-		'label': 'Deposit Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'realized_date',
-		'fieldtype': 'Date',
-		'idx': 6,
-		'label': 'Realized Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'jv_number',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'idx': 7,
-		'label': 'JV Number',
-		'options': 'Journal Voucher',
-		'permlevel': 1
-	}
-]
\ No newline at end of file