Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/accounts/doctype/budget_distribution/budget_distribution.txt b/accounts/doctype/budget_distribution/budget_distribution.txt
index 70ef717..ae668ab 100644
--- a/accounts/doctype/budget_distribution/budget_distribution.txt
+++ b/accounts/doctype/budget_distribution/budget_distribution.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:05", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:29:23", 
+  "modified": "2013-07-22 15:30:37", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -31,6 +31,7 @@
   "parenttype": "DocType", 
   "read": 1, 
   "report": 1, 
+  "role": "Accounts Manager", 
   "submit": 0
  }, 
  {
@@ -77,30 +78,15 @@
   "read_only": 1
  }, 
  {
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "permlevel": 0, 
-  "role": "System Manager", 
-  "write": 1
- }, 
- {
-  "doctype": "DocPerm", 
-  "permlevel": 2, 
-  "role": "System Manager"
- }, 
- {
   "amend": 0, 
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
   "permlevel": 0, 
-  "role": "Accounts Manager", 
   "write": 1
  }, 
  {
   "doctype": "DocPerm", 
-  "permlevel": 2, 
-  "role": "Accounts Manager"
+  "permlevel": 2
  }
 ]
\ No newline at end of file
diff --git a/accounts/doctype/cost_center/cost_center.txt b/accounts/doctype/cost_center/cost_center.txt
index 95c4f5a..a9c7add 100644
--- a/accounts/doctype/cost_center/cost_center.txt
+++ b/accounts/doctype/cost_center/cost_center.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-23 19:57:17", 
   "docstatus": 0, 
-  "modified": "2013-07-09 14:43:41", 
+  "modified": "2013-07-22 15:23:10", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -28,6 +28,7 @@
   "permlevel": 0
  }, 
  {
+  "amend": 0, 
   "doctype": "DocPerm", 
   "name": "__common__", 
   "parent": "Cost Center", 
@@ -179,7 +180,6 @@
   "report_hide": 1
  }, 
  {
-  "amend": 0, 
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
@@ -187,18 +187,10 @@
   "write": 1
  }, 
  {
-  "amend": 0, 
   "cancel": 0, 
   "create": 0, 
   "doctype": "DocPerm", 
   "role": "Accounts User", 
   "write": 0
- }, 
- {
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "role": "System Manager", 
-  "write": 1
  }
 ]
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index 2e89a67..ab4b2b0 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -104,14 +104,6 @@
 	if (doc.is_opening == 'Yes') unhide_field('aging_date');
 }
 
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-	var d = locals[cdt][cdn];
-	if(d.idx == 1){
-		d.debit = 0;
-		d.credit = 0;
-	}
-}
-
 cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
 	var d = locals[cdt][cdn];
 	if (d.against_voucher && !flt(d.debit)) {
diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
index 235188e..accf515 100644
--- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
+++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-30 12:49:46", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:48:10", 
+  "modified": "2013-07-22 15:31:00", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -187,10 +187,6 @@
  }, 
  {
   "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
   "role": "Accounts Manager"
  }, 
  {
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
index 77d55dc..1f2d35e 100644
--- a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:07", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:50:27", 
+  "modified": "2013-07-22 15:31:33", 
   "modified_by": "Administrator", 
   "owner": "jai@webnotestech.com"
  }, 
@@ -35,6 +35,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "Accounts Manager", 
   "submit": 1, 
   "write": 1
  }, 
@@ -130,11 +131,6 @@
   "reqd": 1
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "Accounts Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index 2bdab8a..e73386f 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -22,7 +22,7 @@
 wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
 wn.require('app/buying/doctype/purchase_common/purchase_common.js');
 
-erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.extend({
+erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
 	onload: function() {
 		this._super();
 		
@@ -103,29 +103,14 @@
 	tc_name: function() {
 		this.get_terms();
 	},
-
+	
+	entries_add: function(doc, cdt, cdn) {
+		var row = wn.model.get_doc(cdt, cdn);
+		this.frm.script_manager.copy_from_first_row("entries", row, ["expense_head", "cost_center"]);
+	}
 });
 
-// for backward compatibility: combine new and previous states
-$.extend(cur_frm.cscript, new erpnext.accounts.PurchaseInvoiceController({frm: cur_frm}));
-
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-	
-	cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
-	acc = '';
-	cc = '';
-
-	for(var i = 0; i<cl.length; i++) {
-		if (cl[i].idx == 1){
-			acc = cl[i].expense_head;
-			cc = cl[i].cost_center;
-		}
-		else{
-			if (! cl[i].expense_head) { cl[i].expense_head = acc; refresh_field('expense_head', cl[i].name, 'entries');}
-			if (! cl[i].cost_center)	{cl[i].cost_center = cc; refresh_field('cost_center', cl[i].name, 'entries');}
-		}
-	}
-}
+cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
 
 cur_frm.cscript.is_opening = function(doc, dt, dn) {
 	hide_field('aging_date');
diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
index cd366f6..f902ade 100644
--- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
+++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:08", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:52:17", 
+  "modified": "2013-07-22 15:22:25", 
   "modified_by": "Administrator", 
   "owner": "wasim@webnotestech.com"
  }, 
@@ -85,13 +85,6 @@
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
-  "role": "System Manager", 
-  "write": 1
- }, 
- {
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
   "role": "Purchase Master Manager", 
   "write": 1
  }
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 90239fa..773956a 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -150,6 +150,11 @@
 	paid_amount: function() {
 		this.write_off_outstanding_amount_automatically();
 	},
+	
+	entries_add: function(doc, cdt, cdn) {
+		var row = wn.model.get_doc(cdt, cdn);
+		this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
+	}
 });
 
 // for backward compatibility: combine new and previous states
@@ -197,25 +202,6 @@
 	cur_frm.cscript.hide_fields(doc, dt, dn);
 }
 
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-
-	cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
-	acc = '';
-	cc = '';
-
-	for(var i = 0; i<cl.length; i++) {
-
-		if (cl[i].idx == 1){
-			acc = cl[i].income_account;
-			cc = cl[i].cost_center;
-		}
-		else{
-			if (! cl[i].income_account) { cl[i].income_account = acc; refresh_field('income_account', cl[i].name, 'entries');}
-			if (! cl[i].cost_center)	{cl[i].cost_center = cc;refresh_field('cost_center', cl[i].name, 'entries');}
-		}
-	}
-}
-
 cur_frm.cscript.is_opening = function(doc, dt, dn) {
 	hide_field('aging_date');
 	if (doc.is_opening == 'Yes') unhide_field('aging_date');
diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
index 0ffc27d..20e4076 100644
--- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
+++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:09", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:54:37", 
+  "modified": "2013-07-22 15:22:14", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -24,6 +24,7 @@
   "permlevel": 0
  }, 
  {
+  "amend": 0, 
   "doctype": "DocPerm", 
   "name": "__common__", 
   "parent": "Sales Taxes and Charges Master", 
@@ -97,7 +98,6 @@
   "reqd": 1
  }, 
  {
-  "amend": 0, 
   "cancel": 0, 
   "create": 0, 
   "doctype": "DocPerm", 
@@ -105,7 +105,6 @@
   "write": 0
  }, 
  {
-  "amend": 0, 
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
@@ -116,14 +115,6 @@
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
-  "role": "System Manager", 
-  "write": 1
- }, 
- {
-  "amend": 0, 
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
   "role": "Sales Master Manager", 
   "write": 1
  }
diff --git a/hr/doctype/branch/branch.txt b/hr/doctype/branch/branch.txt
index 971c24b..3df2cd6 100644
--- a/hr/doctype/branch/branch.txt
+++ b/hr/doctype/branch/branch.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:13", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:28:09", 
+  "modified": "2013-07-22 15:30:08", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -61,10 +61,6 @@
  }, 
  {
   "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
   "role": "HR User"
  }, 
  {
diff --git a/hr/doctype/deduction_type/deduction_type.txt b/hr/doctype/deduction_type/deduction_type.txt
index 7bd0fea..1e38f0b 100644
--- a/hr/doctype/deduction_type/deduction_type.txt
+++ b/hr/doctype/deduction_type/deduction_type.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-22 16:50:30", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:34:46", 
+  "modified": "2013-07-22 15:25:14", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -34,6 +34,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "HR User", 
   "submit": 0, 
   "write": 1
  }, 
@@ -69,15 +70,6 @@
   "width": "300px"
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR User"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/hr/doctype/department/department.txt b/hr/doctype/department/department.txt
index 188e52a..1f4e420 100644
--- a/hr/doctype/department/department.txt
+++ b/hr/doctype/department/department.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-05 11:48:26", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:35:06", 
+  "modified": "2013-07-22 15:25:03", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -33,6 +33,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "HR User", 
   "submit": 0, 
   "write": 1
  }, 
@@ -67,15 +68,6 @@
   "options": "Leave Block List"
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR User"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/hr/doctype/earning_type/earning_type.txt b/hr/doctype/earning_type/earning_type.txt
index 0fa8c42..0c84cf1 100644
--- a/hr/doctype/earning_type/earning_type.txt
+++ b/hr/doctype/earning_type/earning_type.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-24 11:03:32", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:36:03", 
+  "modified": "2013-07-22 15:25:26", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -34,6 +34,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "HR User", 
   "submit": 0, 
   "write": 1
  }, 
@@ -90,15 +91,6 @@
   "oldfieldtype": "Currency"
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR User"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/hr/doctype/employment_type/employment_type.txt b/hr/doctype/employment_type/employment_type.txt
index e4a2f24..cabfbd7 100644
--- a/hr/doctype/employment_type/employment_type.txt
+++ b/hr/doctype/employment_type/employment_type.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:14", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:36:27", 
+  "modified": "2013-07-22 15:31:58", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -60,10 +60,6 @@
  }, 
  {
   "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
   "role": "HR User"
  }, 
  {
diff --git a/hr/doctype/grade/grade.txt b/hr/doctype/grade/grade.txt
index b674c31..0050ed9 100644
--- a/hr/doctype/grade/grade.txt
+++ b/hr/doctype/grade/grade.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:14", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:39:58", 
+  "modified": "2013-07-22 15:27:26", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -33,6 +33,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "HR User", 
   "submit": 0, 
   "write": 1
  }, 
@@ -59,15 +60,6 @@
   "reqd": 1
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR User"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/hr/doctype/leave_type/leave_type.txt b/hr/doctype/leave_type/leave_type.txt
index 29960b2..dd339dc 100644
--- a/hr/doctype/leave_type/leave_type.txt
+++ b/hr/doctype/leave_type/leave_type.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-21 09:55:58", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:44:54", 
+  "modified": "2013-07-22 15:32:07", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -100,10 +100,6 @@
  }, 
  {
   "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
   "role": "HR User"
  }, 
  {
diff --git a/hr/doctype/salary_manager/salary_manager.txt b/hr/doctype/salary_manager/salary_manager.txt
index f25de4f..423e789 100644
--- a/hr/doctype/salary_manager/salary_manager.txt
+++ b/hr/doctype/salary_manager/salary_manager.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2012-03-27 14:35:59", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:53:30", 
+  "modified": "2013-07-22 15:22:58", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -34,6 +34,7 @@
   "parenttype": "DocType", 
   "permlevel": 0, 
   "read": 1, 
+  "role": "HR Manager", 
   "write": 1
  }, 
  {
@@ -179,15 +180,6 @@
   "label": "Activity Log"
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR User"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "HR Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt b/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
index 7fa4051..d0a4f47 100644
--- a/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
+++ b/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:48", 
   "docstatus": 0, 
-  "modified": "2013-07-10 14:54:18", 
+  "modified": "2013-07-22 15:27:44", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -22,20 +22,6 @@
   "permlevel": 0
  }, 
  {
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "name": "__common__", 
-  "parent": "Salary Slip Deduction", 
-  "parentfield": "permissions", 
-  "parenttype": "DocType", 
-  "permlevel": 0, 
-  "read": 1, 
-  "report": 1, 
-  "role": "System Manager", 
-  "submit": 0, 
-  "write": 1
- }, 
- {
   "doctype": "DocType", 
   "name": "Salary Slip Deduction"
  }, 
@@ -72,8 +58,5 @@
   "fieldname": "d_depends_on_lwp", 
   "fieldtype": "Check", 
   "label": "Depends on LWP"
- }, 
- {
-  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/hr/doctype/salary_slip_earning/salary_slip_earning.txt b/hr/doctype/salary_slip_earning/salary_slip_earning.txt
index 4ac3f39..3fc25fa 100644
--- a/hr/doctype/salary_slip_earning/salary_slip_earning.txt
+++ b/hr/doctype/salary_slip_earning/salary_slip_earning.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:48", 
   "docstatus": 0, 
-  "modified": "2013-07-10 14:54:18", 
+  "modified": "2013-07-22 15:27:56", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -22,20 +22,6 @@
   "permlevel": 0
  }, 
  {
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "name": "__common__", 
-  "parent": "Salary Slip Earning", 
-  "parentfield": "permissions", 
-  "parenttype": "DocType", 
-  "permlevel": 0, 
-  "read": 1, 
-  "report": 1, 
-  "role": "System Manager", 
-  "submit": 0, 
-  "write": 1
- }, 
- {
   "doctype": "DocType", 
   "name": "Salary Slip Earning"
  }, 
@@ -72,8 +58,5 @@
   "fieldname": "e_depends_on_lwp", 
   "fieldtype": "Check", 
   "label": "Depends on LWP"
- }, 
- {
-  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt
index 693f17d..92362ae 100644
--- a/manufacturing/doctype/bom/bom.txt
+++ b/manufacturing/doctype/bom/bom.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-22 15:11:38", 
   "docstatus": 0, 
-  "modified": "2013-07-08 16:18:33", 
+  "modified": "2013-07-22 15:28:38", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -261,10 +261,6 @@
  }, 
  {
   "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
   "role": "Manufacturing Manager"
  }, 
  {
diff --git a/manufacturing/doctype/bom_item/bom_item.txt b/manufacturing/doctype/bom_item/bom_item.txt
index 85fbcf6..a41ab65 100644
--- a/manufacturing/doctype/bom_item/bom_item.txt
+++ b/manufacturing/doctype/bom_item/bom_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:49", 
   "docstatus": 0, 
-  "modified": "2013-07-10 14:54:05", 
+  "modified": "2013-07-22 15:28:20", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -21,19 +21,6 @@
   "permlevel": 0
  }, 
  {
-  "doctype": "DocPerm", 
-  "name": "__common__", 
-  "parent": "BOM Item", 
-  "parentfield": "permissions", 
-  "parenttype": "DocType", 
-  "permlevel": 0, 
-  "read": 1, 
-  "report": 1, 
-  "role": "System Manager", 
-  "submit": 0, 
-  "write": 1
- }, 
- {
   "doctype": "DocType", 
   "name": "BOM Item"
  }, 
@@ -146,8 +133,5 @@
   "oldfieldtype": "Float", 
   "print_hide": 1, 
   "read_only": 1
- }, 
- {
-  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/manufacturing/doctype/bom_operation/bom_operation.txt b/manufacturing/doctype/bom_operation/bom_operation.txt
index 86dffe9..01d7d00 100644
--- a/manufacturing/doctype/bom_operation/bom_operation.txt
+++ b/manufacturing/doctype/bom_operation/bom_operation.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:49", 
   "docstatus": 0, 
-  "modified": "2013-07-10 14:54:05", 
+  "modified": "2013-07-22 15:28:28", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -22,19 +22,6 @@
   "permlevel": 0
  }, 
  {
-  "doctype": "DocPerm", 
-  "name": "__common__", 
-  "parent": "BOM Operation", 
-  "parentfield": "permissions", 
-  "parenttype": "DocType", 
-  "permlevel": 0, 
-  "read": 1, 
-  "report": 1, 
-  "role": "System Manager", 
-  "submit": 0, 
-  "write": 1
- }, 
- {
   "doctype": "DocType", 
   "name": "BOM Operation"
  }, 
@@ -93,8 +80,5 @@
   "oldfieldname": "operating_cost", 
   "oldfieldtype": "Currency", 
   "reqd": 0
- }, 
- {
-  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt b/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt
index e74f3bb..fab7dd0 100644
--- a/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt
+++ b/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:49", 
   "docstatus": 0, 
-  "modified": "2013-07-10 14:54:12", 
+  "modified": "2013-07-22 15:26:23", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -23,19 +23,6 @@
   "permlevel": 0
  }, 
  {
-  "doctype": "DocPerm", 
-  "name": "__common__", 
-  "parent": "Production Plan Sales Order", 
-  "parentfield": "permissions", 
-  "parenttype": "DocType", 
-  "permlevel": 0, 
-  "read": 1, 
-  "report": 1, 
-  "role": "System Manager", 
-  "submit": 0, 
-  "write": 1
- }, 
- {
   "doctype": "DocType", 
   "name": "Production Plan Sales Order"
  }, 
@@ -80,8 +67,5 @@
   "print_width": "120px", 
   "read_only": 1, 
   "width": "120px"
- }, 
- {
-  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
index 401b172..85d8dab 100644
--- a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
+++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-21 12:03:47", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:51:19", 
+  "modified": "2013-07-22 15:26:45", 
   "modified_by": "Administrator", 
   "owner": "jai@webnotestech.com"
  }, 
@@ -34,6 +34,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 0, 
+  "role": "Manufacturing User", 
   "submit": 0, 
   "write": 1
  }, 
@@ -215,15 +216,6 @@
   "options": "raise_purchase_request"
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "Manufacturing User"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "Manufacturing Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/patches/july_2013/p08_custom_print_format_net_total_export.py b/patches/july_2013/p08_custom_print_format_net_total_export.py
new file mode 100644
index 0000000..a6a8335
--- /dev/null
+++ b/patches/july_2013/p08_custom_print_format_net_total_export.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+import webnotes
+import re
+
+def execute():
+	for name, html in webnotes.conn.sql("""select name, html from `tabPrint Format` where standard='No'"""):
+		changed = False
+		for match in re.findall("(doc.net_total.*doc.conversion_rate)", html):
+			if match.replace(" ", "") == "doc.net_total/doc.conversion_rate":
+				html = html.replace(match, "doc.net_total_export")
+				changed = True
+		
+		if changed:
+			webnotes.conn.set_value("Print Format", name, "html", html)
+			
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index d484f16..e8a03ff 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -163,9 +163,6 @@
 	"patches.february_2013.p05_leave_application",
 	"patches.february_2013.gle_floating_point_issue_revisited",
 	"patches.february_2013.fix_outstanding",
-	'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Classic") # 2013-02-19',
-	'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-02-19',
-	'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-02-19',
 	"execute:webnotes.delete_doc('DocType', 'Service Order')",
 	"execute:webnotes.delete_doc('DocType', 'Service Quotation')",
 	"execute:webnotes.delete_doc('DocType', 'Service Order Detail')",
@@ -176,9 +173,6 @@
 	"execute:webnotes.conn.sql(\"update `tabReport` set report_type=if(ifnull(query, '')='', 'Report Builder', 'Query Report') where is_standard='No'\")",
 	"execute:webnotes.conn.sql(\"update `tabReport` set report_name=name where ifnull(report_name,'')='' and is_standard='No'\")",
 	"patches.february_2013.p08_todo_query_report",
-	'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Classic") # 2013-02-26',
-	'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Modern") # 2013-02-26',
-	'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Spartan") # 2013-02-26',
 	"execute:(not webnotes.conn.exists('Role', 'Projects Manager')) and webnotes.doc({'doctype':'Role', 'role_name':'Projects Manager'}).insert()",
 	"patches.february_2013.p09_remove_cancelled_warehouses",
 	"patches.march_2013.update_po_prevdoc_doctype",
@@ -210,9 +204,6 @@
 	"patches.april_2013.p01_update_serial_no_valuation_rate",
 	"patches.april_2013.p02_add_country_and_currency",
 	"patches.april_2013.p03_fixes_for_lead_in_quotation",
-	'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Classic") # 2013-04-02',
-	'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-04-02',
-	'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-04-02',
 	"patches.april_2013.p04_reverse_modules_list",
 	"patches.april_2013.p04_update_role_in_pages",
 	"patches.april_2013.p05_update_file_data",
@@ -257,4 +248,17 @@
 	"patches.july_2013.p05_custom_doctypes_in_list_view",
 	"patches.july_2013.p06_same_sales_rate",
 	"patches.july_2013.p07_repost_billed_amt_in_sales_cycle",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-07-22",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-07-22",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-07-22",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-07-22",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-07-22",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-07-22",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-07-22",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-07-22",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-07-22",
+	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-07-22",
+	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-07-22",
+	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-07-22",
+	"patches.july_2013.p08_custom_print_format_net_total_export",
 ]
\ No newline at end of file
diff --git a/selling/doctype/installation_note/installation_note.txt b/selling/doctype/installation_note/installation_note.txt
index 7486586..27a2ad5 100644
--- a/selling/doctype/installation_note/installation_note.txt
+++ b/selling/doctype/installation_note/installation_note.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-04-30 13:13:06", 
   "docstatus": 0, 
-  "modified": "2013-07-15 17:09:08", 
+  "modified": "2013-07-22 15:23:59", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -29,7 +29,8 @@
   "parentfield": "permissions", 
   "parenttype": "DocType", 
   "read": 1, 
-  "report": 1
+  "report": 1, 
+  "role": "Sales User"
  }, 
  {
   "doctype": "DocType", 
@@ -255,7 +256,6 @@
   "create": 1, 
   "doctype": "DocPerm", 
   "permlevel": 0, 
-  "role": "System Manager", 
   "submit": 1, 
   "write": 1
  }, 
@@ -265,45 +265,6 @@
   "create": 0, 
   "doctype": "DocPerm", 
   "permlevel": 1, 
-  "role": "System Manager", 
-  "submit": 0
- }, 
- {
-  "amend": 1, 
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "permlevel": 0, 
-  "role": "Sales User", 
-  "submit": 1, 
-  "write": 1
- }, 
- {
-  "amend": 0, 
-  "cancel": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "permlevel": 1, 
-  "role": "Sales User", 
-  "submit": 0
- }, 
- {
-  "amend": 1, 
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "permlevel": 0, 
-  "role": "Sales Manager", 
-  "submit": 1, 
-  "write": 1
- }, 
- {
-  "amend": 0, 
-  "cancel": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "permlevel": 1, 
-  "role": "Sales Manager", 
   "submit": 0
  }
 ]
\ No newline at end of file
diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js
index a0ba0df..45a9b5b 100644
--- a/selling/doctype/sales_common/sales_common.js
+++ b/selling/doctype/sales_common/sales_common.js
@@ -286,7 +286,7 @@
 	},
 	
 	warehouse: function(doc, cdt, cdn) {
-		var item = webnotes.get_doc(cdt, cdn);
+		var item = wn.model.get_doc(cdt, cdn);
 		if(item.item_code && (item.warehouse || item.reserved_warehouse)) {
 			this.frm.call({
 				method: "selling.utils.get_available_qty",
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index ae2d8ee..8a10587 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -77,12 +77,6 @@
 				website_settings.doclist.append({
 					"doctype": "Top Bar Item",
 					"parentfield": "top_bar_items",
-					"label":"Home",
-					"url": webpage.doc.name
-				})
-				website_settings.doclist.append({
-					"doctype": "Top Bar Item",
-					"parentfield": "top_bar_items",
 					"label":"Contact",
 					"url": "contact"
 				})
diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js
index b642735..f672e7a 100644
--- a/setup/doctype/item_group/item_group.js
+++ b/setup/doctype/item_group/item_group.js
@@ -37,7 +37,7 @@
 	return{
 		filters:[
 			['Item Group', 'is_group', '=', 'Yes'],
-			['Item Group', 'naem', '!=', doc.item_group_name]
+			['Item Group', 'name', '!=', doc.item_group_name]
 		]
 	}
 }
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt
index a2b04e7..44faa49 100644
--- a/setup/doctype/item_group/item_group.txt
+++ b/setup/doctype/item_group/item_group.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-03-28 10:35:29", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:43:08", 
+  "modified": "2013-07-22 15:29:54", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -194,13 +194,6 @@
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
-  "role": "System Manager", 
-  "write": 1
- }, 
- {
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
   "role": "Material Master Manager", 
   "write": 1
  }
diff --git a/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt b/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
index d580410..d9174e3 100644
--- a/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
+++ b/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:24", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:52:43", 
+  "modified": "2013-07-22 15:29:22", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -23,6 +23,7 @@
   "permlevel": 0
  }, 
  {
+  "amend": 0, 
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
@@ -33,6 +34,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "Sales Master Manager", 
   "submit": 0, 
   "write": 1
  }, 
@@ -59,12 +61,6 @@
   "reqd": 1
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "amend": 0, 
-  "doctype": "DocPerm", 
-  "role": "Sales Master Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index b2a1ffe..b1bb269 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -14,8 +14,25 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-cur_frm.add_fetch("price_list_name", "currency", "ref_currency");
-cur_frm.add_fetch("price_list_name", "buying_or_selling", "buying_or_selling");
+wn.provide("erpnext.stock");
+
+erpnext.stock.Item = wn.ui.form.Controller.extend({
+	onload: function() {
+		this.frm.add_fetch("price_list_name", "currency", "ref_currency");
+		this.frm.add_fetch("price_list_name", "buying_or_selling", "buying_or_selling");
+	},
+	
+	ref_rate_details_add: function(doc, cdt, cdn) {
+		var row = wn.model.get_doc(cdt, cdn);
+		if(row.price_list_name && !row.ref_currency) {
+			// execute fetch
+			var df = wn.meta.get_docfield(row.doctype, "price_list_name", row.parent);
+			this.frm.script_manager.validate_link_and_fetch(df, row.name, row.price_list_name);
+		}
+	}
+});
+
+cur_frm.script_manager.make(erpnext.stock.Item);
 
 cur_frm.cscript.refresh = function(doc) {
 	// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
@@ -157,11 +174,6 @@
   cur_frm.cscript.weight_to_validate(doc,cdt,cdn);
 }
 
-cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
-	locals[cdt][cdn].ref_currency = sys_defaults.currency;
-	refresh_field('ref_currency',cdn,'ref_rate_details');
-}
-
 cur_frm.fields_dict.item_customer_details.grid.get_field("customer_name").get_query = 
 function(doc,cdt,cdn) {
 		return{	query:"controllers.queries.customer_query" } }
diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
index 36a5d72..53f2407 100644
--- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
+++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-22 16:50:39", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:43:57", 
+  "modified": "2013-07-22 15:31:20", 
   "modified_by": "Administrator", 
   "owner": "wasim@webnotestech.com"
  }, 
@@ -115,10 +115,6 @@
  }, 
  {
   "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
   "role": "Purchase User"
  }
 ]
\ No newline at end of file
diff --git a/stock/doctype/serial_no/serial_no.txt b/stock/doctype/serial_no/serial_no.txt
index 72f78286..efa35f5 100644
--- a/stock/doctype/serial_no/serial_no.txt
+++ b/stock/doctype/serial_no/serial_no.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-16 10:59:15", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:54:52", 
+  "modified": "2013-07-22 15:29:43", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -524,13 +524,6 @@
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
-  "role": "System Manager", 
-  "write": 1
- }, 
- {
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
   "role": "Material Master Manager", 
   "write": 1
  }, 
diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js
index 123c9fb..7032f92 100644
--- a/stock/doctype/stock_entry/stock_entry.js
+++ b/stock/doctype/stock_entry/stock_entry.js
@@ -234,9 +234,15 @@
 		}
 	},
 
+	mtn_details_add: function(doc, cdt, cdn) {
+		var row = wn.model.get_doc(cdt, cdn);
+		
+		if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse;
+		if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse;
+	},
 });
 
-cur_frm.cscript = new erpnext.stock.StockEntry({frm: cur_frm});
+cur_frm.script_manager.make(erpnext.stock.StockEntry);
 
 cur_frm.cscript.toggle_related_fields = function(doc) {
 	disable_from_warehouse = inList(["Material Receipt", "Sales Return"], doc.purpose);
@@ -296,19 +302,6 @@
 	cur_frm.cscript.toggle_related_fields(doc, cdt, cdn);
 }
 
-// copy over source and target warehouses
-cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
-	var d = locals[cdt][cdn];
-	if(!d.s_warehouse && doc.from_warehouse) {
-		d.s_warehouse = doc.from_warehouse
-		refresh_field('s_warehouse', cdn, 'mtn_details')
-	}
-	if(!d.t_warehouse && doc.to_warehouse) {
-		d.t_warehouse = doc.to_warehouse
-		refresh_field('t_warehouse', cdn, 'mtn_details')
-	}
-}
-
 // Overloaded query for link batch_no
 cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];		
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
index fc63b8d..7ddcbf7 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-03-28 10:35:31", 
   "docstatus": 0, 
-  "modified": "2013-07-05 14:56:37", 
+  "modified": "2013-07-22 15:22:44", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -31,6 +31,7 @@
   "permlevel": 0
  }, 
  {
+  "amend": 0, 
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
@@ -41,6 +42,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "Material Manager", 
   "submit": 1, 
   "write": 1
  }, 
@@ -156,12 +158,6 @@
   "print_hide": 1
  }, 
  {
-  "amend": 0, 
-  "doctype": "DocPerm", 
-  "role": "Material Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/stock/doctype/warehouse/warehouse.txt b/stock/doctype/warehouse/warehouse.txt
index 95b0b52..f6d3bcc 100644
--- a/stock/doctype/warehouse/warehouse.txt
+++ b/stock/doctype/warehouse/warehouse.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-03-07 18:50:32", 
   "docstatus": 0, 
-  "modified": "2013-07-10 18:46:40", 
+  "modified": "2013-07-22 15:20:35", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -24,11 +24,13 @@
   "read_only": 0
  }, 
  {
+  "amend": 0, 
   "doctype": "DocPerm", 
   "name": "__common__", 
   "parent": "Warehouse", 
   "parentfield": "permissions", 
   "parenttype": "DocType", 
+  "permlevel": 0, 
   "read": 1, 
   "report": 1, 
   "submit": 0
@@ -201,47 +203,17 @@
   "permlevel": 2
  }, 
  {
-  "amend": 0, 
   "cancel": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
-  "permlevel": 0, 
   "role": "Material Master Manager", 
   "write": 1
  }, 
  {
-  "cancel": 1, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "permlevel": 0, 
-  "role": "System Manager", 
-  "write": 1
- }, 
- {
-  "amend": 0, 
   "cancel": 0, 
   "create": 0, 
   "doctype": "DocPerm", 
-  "permlevel": 0, 
-  "role": "Material Manager", 
-  "write": 0
- }, 
- {
-  "amend": 0, 
-  "cancel": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "permlevel": 0, 
   "role": "Material User", 
   "write": 0
- }, 
- {
-  "amend": 0, 
-  "cancel": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "permlevel": 2, 
-  "role": "System Manager", 
-  "write": 1
  }
 ]
\ No newline at end of file
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.txt b/support/doctype/maintenance_schedule/maintenance_schedule.txt
index 0491946..c14764c 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.txt
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:30", 
   "docstatus": 0, 
-  "modified": "2013-07-10 12:18:19", 
+  "modified": "2013-07-22 15:32:36", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -35,6 +35,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "Maintenance Manager", 
   "submit": 1, 
   "write": 1
  }, 
@@ -249,11 +250,6 @@
   "read_only": 1
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "Maintenance Manager"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/support/doctype/maintenance_visit/maintenance_visit.txt b/support/doctype/maintenance_visit/maintenance_visit.txt
index 478d9ac..ee84f96 100644
--- a/support/doctype/maintenance_visit/maintenance_visit.txt
+++ b/support/doctype/maintenance_visit/maintenance_visit.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:31", 
   "docstatus": 0, 
-  "modified": "2013-07-10 12:26:15", 
+  "modified": "2013-07-22 15:24:40", 
   "modified_by": "Administrator", 
   "owner": "ashwini@webnotestech.com"
  }, 
@@ -35,6 +35,7 @@
   "permlevel": 0, 
   "read": 1, 
   "report": 1, 
+  "role": "Maintenance User", 
   "submit": 1, 
   "write": 1
  }, 
@@ -308,15 +309,6 @@
   "print_hide": 1
  }, 
  {
-  "doctype": "DocPerm", 
-  "role": "System Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "Maintenance Manager"
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "Maintenance User"
+  "doctype": "DocPerm"
  }
 ]
\ No newline at end of file
diff --git a/website/templates/html/navbar.html b/website/templates/html/navbar.html
index 9166cde..68706ec 100644
--- a/website/templates/html/navbar.html
+++ b/website/templates/html/navbar.html
@@ -1,5 +1,5 @@
 <div class="navbar">
-	{%- if brand_html %}<a class="navbar-brand" href="index">{{ brand_html }}</a>{% endif -%}
+	<a class="navbar-brand" href="index">{{ brand_html or "<i class='icon-home'></i>"}}</a>
 	<div class="container">
 		<button type="button" class="navbar-toggle" data-toggle="collapse" 
 			data-target=".navbar-responsive-collapse">