Merge pull request #16190 from SaiFi0102/Travis-Fix

[Staging] Travis Fix: bench reinstall allow setting MariaDB root user/pass #6599
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index b62d9b0..5162c29 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -42,6 +42,20 @@
 			frm.toggle_display('offline_pos_section', is_offline);
 			frm.toggle_display('print_format_for_online', !is_offline);
 		});
+
+		frm.set_query('company_address', function(doc) {
+			if(!doc.company) {
+				frappe.throw(__('Please set Company'));
+			}
+
+			return {
+				query: 'frappe.contacts.doctype.address.address.address_query',
+				filters: {
+					link_doctype: 'Company',
+					link_name: doc.company
+				}
+			};
+		});
 	},
 
 	refresh: function(frm) {
@@ -49,11 +63,11 @@
 			frm.trigger("toggle_display_account_head");
 		}
 	},
-	
+
 	company: function(frm) {
 		frm.trigger("toggle_display_account_head");
 	},
-	
+
 	toggle_display_account_head: function(frm) {
 		frm.toggle_display('expense_account',
 			erpnext.is_perpetual_inventory_enabled(frm.doc.company));
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index 610ed51..a089b4c 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_events_in_timeline": 0, 
  "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 1, 
@@ -13,6 +14,7 @@
  "fields": [
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -40,11 +42,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -70,11 +73,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -101,11 +105,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
-   "unique": 0
+   "translatable": 0, 
+   "unique": 1
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -134,11 +139,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -166,11 +172,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -197,11 +204,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -228,11 +236,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -259,11 +268,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -290,11 +300,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -321,11 +332,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
-  },  
+  }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -352,10 +364,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -381,11 +395,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -414,11 +429,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -447,16 +463,17 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fetch_from": "company.country",
+   "fetch_from": "company.country", 
    "fieldname": "country", 
    "fieldtype": "Read Only", 
    "hidden": 0, 
@@ -480,11 +497,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -514,11 +532,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -546,11 +565,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -577,11 +597,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -609,11 +630,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -639,11 +661,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -671,11 +694,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -702,11 +726,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -734,11 +759,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -764,11 +790,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -796,11 +823,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -827,11 +855,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -859,11 +888,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
@@ -892,11 +922,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
@@ -925,11 +956,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -955,11 +987,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -988,11 +1021,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1021,11 +1055,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1052,11 +1087,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1086,11 +1122,77 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company_address_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company Address", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company_address", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company Address Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Address", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1118,11 +1220,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1152,11 +1255,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1182,11 +1286,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1215,11 +1320,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1247,11 +1353,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1279,11 +1386,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1312,11 +1420,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1345,11 +1454,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1377,11 +1487,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1409,11 +1520,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1439,11 +1551,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1472,11 +1585,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1504,11 +1618,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1537,11 +1652,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1570,7 +1686,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -1585,7 +1701,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-09-05 12:43:37.272875",
+ "modified": "2018-12-03 14:16:08.589778", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
@@ -1639,5 +1755,6 @@
  "sort_order": "DESC", 
  "title_field": "pos_profile_name", 
  "track_changes": 0, 
- "track_seen": 0
-}
+ "track_seen": 0, 
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index a4588b3..91a44b3 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -313,6 +313,10 @@
 		erpnext.setup_serial_no();
 	},
 
+	packed_items_on_form_rendered: function(doc, grid_row) {
+		erpnext.setup_serial_no();
+	},
+
 	make_sales_return: function() {
 		frappe.model.open_mapped_doc({
 			method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_sales_return",
@@ -585,7 +589,7 @@
 
 		frm.set_query('company_address', function(doc) {
 			if(!doc.company) {
-				frappe.throw(_('Please set Company'));
+				frappe.throw(__('Please set Company'));
 			}
 
 			return {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 6387003..f3ec775 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -131,7 +131,7 @@
 		#validate amount in mode of payments for returned invoices for pos must be negative
 		if self.is_pos and self.is_return:
 			self.verify_payment_amount_is_negative()
-			
+
 		if self.redeem_loyalty_points and self.loyalty_program and self.loyalty_points:
 			validate_loyalty_points(self, self.loyalty_points)
 
@@ -397,7 +397,7 @@
 				self.account_for_change_amount = pos.get('account_for_change_amount')
 
 			for fieldname in ('territory', 'naming_series', 'currency', 'taxes_and_charges', 'letter_head', 'tc_name',
-				'selling_price_list', 'company', 'select_print_heading', 'cash_bank_account',
+				'selling_price_list', 'company', 'select_print_heading', 'cash_bank_account', 'company_address',
 				'write_off_account', 'write_off_cost_center', 'apply_discount_on'):
 					if (not for_validate) or (for_validate and not self.get(fieldname)):
 						self.set(fieldname, pos.get(fieldname))
@@ -713,7 +713,7 @@
 		return gl_entries
 
 	def make_customer_gl_entry(self, gl_entries):
-		# Checked both rounding_adjustment and rounded_total 
+		# Checked both rounding_adjustment and rounded_total
 		# because rounded_total had value even before introcution of posting GLE based on rounded total
 		grand_total = self.rounded_total if (self.rounding_adjustment and self.rounded_total) else self.grand_total
 		if grand_total:
@@ -1026,7 +1026,7 @@
 	def verify_payment_amount_is_negative(self):
 		for entry in self.payments:
 			if entry.amount > 0:
-				frappe.throw(_("Row #{0} (Payment Table): Amount must be negative").format(entry.idx))				
+				frappe.throw(_("Row #{0} (Payment Table): Amount must be negative").format(entry.idx))
 
 	# collection of the loyalty points, create the ledger entry for that.
 	def make_loyalty_point_entry(self):
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index e5cdad1..7a91bd2 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -537,7 +537,7 @@
 		'dl.link_doctype=%s '
 		'and dl.link_name=%s '
 		'and dl.parenttype="Address" '
-		'and '
+		'and ifnull(ta.disabled, 0) = 0 and'
 		'(ta.address_type="Shipping" or ta.is_shipping_address=1) '
 		'order by ta.is_shipping_address desc, ta.address_type desc limit 1',
 		(doctype, name)
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 9370f04..0a025f6 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -11,36 +11,6 @@
 			"default": frappe.defaults.get_user_default("Company")
 		},
 		{
-			"fieldname":"finance_book",
-			"label": __("Finance Book"),
-			"fieldtype": "Link",
-			"options": "Finance Book"
-		},
-		{
-			"fieldname":"supplier",
-			"label": __("Supplier"),
-			"fieldtype": "Link",
-			"options": "Supplier",
-			on_change: () => {
-				var supplier = frappe.query_report.get_filter_value('supplier');
-				frappe.db.get_value('Supplier', supplier, "tax_id", function(value) {
-					frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
-				});
-			}
-		},
-		{
-			"fieldname":"supplier_group",
-			"label": __("Supplier Group"),
-			"fieldtype": "Link",
-			"options": "Supplier Group"
-		},		
-		{
-			"fieldname":"report_date",
-			"label": __("As on Date"),
-			"fieldtype": "Date",
-			"default": frappe.datetime.get_today()
-		},
-		{
 			"fieldname":"ageing_based_on",
 			"label": __("Ageing Based On"),
 			"fieldtype": "Select",
@@ -48,7 +18,10 @@
 			"default": "Posting Date"
 		},
 		{
-			"fieldtype": "Break",
+			"fieldname":"report_date",
+			"label": __("As on Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today()
 		},
 		{
 			"fieldname":"range1",
@@ -72,6 +45,34 @@
 			"reqd": 1
 		},
 		{
+			"fieldname":"finance_book",
+			"label": __("Finance Book"),
+			"fieldtype": "Link",
+			"options": "Finance Book"
+		},
+		{
+			"fieldname":"supplier",
+			"label": __("Supplier"),
+			"fieldtype": "Link",
+			"options": "Supplier",
+			on_change: () => {
+				var supplier = frappe.query_report.get_filter_value('supplier');
+				if (supplier) {
+					frappe.db.get_value('Supplier', supplier, "tax_id", function(value) {
+						frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
+					});
+				} else {
+					frappe.query_report.set_filter_value('tax_id', "");
+				}
+			}
+		},
+		{
+			"fieldname":"supplier_group",
+			"label": __("Supplier Group"),
+			"fieldtype": "Link",
+			"options": "Supplier Group"
+		},
+		{
 			"fieldname":"tax_id",
 			"label": __("Tax Id"),
 			"fieldtype": "Data",
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
index 77b099f..7823cac 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
@@ -11,24 +11,6 @@
 			"default": frappe.defaults.get_user_default("Company")
 		},
 		{
-			"fieldname":"supplier",
-			"label": __("Supplier"),
-			"fieldtype": "Link",
-			"options": "Supplier"
-		},
-		{
-			"fieldname":"supplier_group",
-			"label": __("Supplier Group"),
-			"fieldtype": "Link",
-			"options": "Supplier Group"
-		},		
-		{
-			"fieldname":"report_date",
-			"label": __("Date"),
-			"fieldtype": "Date",
-			"default": frappe.datetime.get_today()
-		},
-		{
 			"fieldname":"ageing_based_on",
 			"label": __("Ageing Based On"),
 			"fieldtype": "Select",
@@ -36,7 +18,10 @@
 			"default": "Posting Date"
 		},
 		{
-			"fieldtype": "Break",
+			"fieldname":"report_date",
+			"label": __("Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today()
 		},
 		{
 			"fieldname":"range1",
@@ -58,6 +43,24 @@
 			"fieldtype": "Int",
 			"default": "90",
 			"reqd": 1
+		},
+		{
+			"fieldname":"finance_book",
+			"label": __("Finance Book"),
+			"fieldtype": "Link",
+			"options": "Finance Book"
+		},
+		{
+			"fieldname":"supplier",
+			"label": __("Supplier"),
+			"fieldtype": "Link",
+			"options": "Supplier"
+		},
+		{
+			"fieldname":"supplier_group",
+			"label": __("Supplier Group"),
+			"fieldtype": "Link",
+			"options": "Supplier Group"
 		}
 	],
 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index 4930207..fd462a6 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -1,24 +1,14 @@
-{% if(filters.show_pdc_in_print) { %}
-	<style>
-	@media screen {
-	  .print-format {
-	    padding: 4mm;
-		font-size: 8.0pt !important;
-		font-family: Tahoma, sans-serif;
-	  }
-	}
-	</style>
-{% } %}
 <style>
-	.print-format {
-		padding: 4mm;
-		font-size: 8.0pt !important;
-		font-family: Tahoma, sans-serif;
-	}
+.print-format {
+	padding: 4mm;
+	font-size: 8.0pt !important;
+}
+.print-format td {
+	vertical-align:middle !important;
+}
 </style>
 
-
-<h2 class="text-center">{%= __(report.report_name) %}</h2>
+<h2 class="text-center" style="margin-top:0">{%= __(report.report_name) %}</h2>
 <h4 class="text-center">
 	{% if (filters.customer_name) { %}
 		{%= filters.customer_name %}
@@ -36,7 +26,20 @@
 	{%= __("Until") %}
 	{%= frappe.datetime.str_to_user(filters.report_date) %}
 </h5>
-<hr>
+
+<div class="clearfix">
+	<div class="pull-left">
+	{% if(filters.payment_terms) { %}
+		<strong>{%= __("Payment Terms") %}:</strong> {%= filters.payment_terms %}
+	{% } %}
+	</div>
+	<div class="pull-right">
+	{% if(filters.credit_limit) { %}
+		<strong>{%= __("Credit Limit") %}:</strong> {%= format_currency(filters.credit_limit) %}
+	{% } %}
+	</div>
+</div>
+
 {% if(filters.show_pdc_in_print) { %}
 	{% var balance_row = data.slice(-1).pop();
 		   var range1 = report.columns[11].label;
@@ -104,17 +107,21 @@
 	<thead>
 		<tr>
 			{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
-				<th style="width: 18%">{%= __("Date") %}</th>
-				<th style="width: 17%">{%= __("Reference") %}</th>
+				<th style="width: 7%">{%= __("Date") %}</th>
+				<th style="width: 7%">{%= __("Age (Days)") %}</th>
+				<th style="width: 13%">{%= __("Reference") %}</th>
+				{% if(report.report_name === "Accounts Receivable") { %}
+				<th style="width: 10%">{%= __("Sales Person") %}</th>
+				{% } %}
 				{% if(!filters.show_pdc_in_print) { %}
 				<th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
 				{% } %}
-				<th style="width: 10%">{%= __("Invoiced Amount") %}</th>
+				<th style="width: 10%; text-align: right">{%= __("Invoiced Amount") %}</th>
 				{% if(!filters.show_pdc_in_print) { %}
-					<th style="width: 10%">{%= __("Paid Amount") %}</th>
-					<th style="width: 10%">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
+					<th style="width: 10%; text-align: right">{%= __("Paid Amount") %}</th>
+					<th style="width: 10%; text-align: right">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
 				{% } %}
-				<th style="width: 15%">{%= __("Outstanding Amount") %}</th>
+				<th style="width: 15%; text-align: right">{%= __("Outstanding Amount") %}</th>
 				{% if(filters.show_pdc_in_print) { %}
 					{% if(report.report_name === "Accounts Receivable") { %}
 						<th style="width: 10%">{%= __("Customer LPO No.") %}</th>
@@ -139,6 +146,7 @@
 			{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
 				{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
 					<td>{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}</td>
+					<td style="text-align: right">{%= data[i][__("Age (Days)")] %}</td>
 					<td>
 						{% if(!filters.show_pdc_in_print) { %}
 							{%= data[i]["voucher_type"] %}
@@ -146,6 +154,11 @@
 						{% } %}
 						{%= data[i]["voucher_no"] %}
 					</td>
+
+					{% if(report.report_name === "Accounts Receivable") { %}
+					<td>{%= data[i]["sales_person"] %}</td>
+					{% } %}
+
 					{% if(!filters.show_pdc_in_print) { %}
 					<td>
 						{% if(!(filters.customer || filters.supplier)) { %}
@@ -156,10 +169,15 @@
 								<br> {%= data[i][__("Supplier Name")] %}
 							{% } %}
 						{% } %}
-						<br>{%= __("Remarks") %}:
-						{%= data[i][__("Remarks")] %}
+						<div>
+						{% if data[i][__("Remarks")] %}
+							{%= __("Remarks") %}:
+							{%= data[i][__("Remarks")] %}
+						{% } %}
+						</div>
 					</td>
 					{% } %}
+
 					<td style="text-align: right">
 						{%= format_currency(data[i]["invoiced_amount"], data[i]["currency"]) %}</td>
 
@@ -187,7 +205,11 @@
 					{% if(!filters.show_pdc_in_print) { %}
 					<td></td>
 					{% } %}
-					<td><b>{%= __("Total") %}</b></td>
+					{% if(report.report_name === "Accounts Receivable") { %}
+					<td></td>
+					{% } %}
+					<td></td>
+					<td style="text-align: right"><b>{%= __("Total") %}</b></td>
 					<td style="text-align: right">
 						{%= format_currency(data[i]["invoiced_amount"], data[i]["currency"] ) %}</td>
 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index fda4960..b1bdce9 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -11,6 +11,40 @@
 			"default": frappe.defaults.get_user_default("Company")
 		},
 		{
+			"fieldname":"ageing_based_on",
+			"label": __("Ageing Based On"),
+			"fieldtype": "Select",
+			"options": 'Posting Date\nDue Date',
+			"default": "Posting Date"
+		},
+		{
+			"fieldname":"report_date",
+			"label": __("As on Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today()
+		},
+		{
+			"fieldname":"range1",
+			"label": __("Ageing Range 1"),
+			"fieldtype": "Int",
+			"default": "30",
+			"reqd": 1
+		},
+		{
+			"fieldname":"range2",
+			"label": __("Ageing Range 2"),
+			"fieldtype": "Int",
+			"default": "60",
+			"reqd": 1
+		},
+		{
+			"fieldname":"range3",
+			"label": __("Ageing Range 3"),
+			"fieldtype": "Int",
+			"default": "90",
+			"reqd": 1
+		},
+		{
 			"fieldname":"finance_book",
 			"label": __("Finance Book"),
 			"fieldtype": "Link",
@@ -23,10 +57,19 @@
 			"options": "Customer",
 			on_change: () => {
 				var customer = frappe.query_report.get_filter_value('customer');
-				frappe.db.get_value('Customer', customer, ["tax_id", "customer_name"], function(value) {
-					frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
-					frappe.query_report.set_filter_value('customer_name', value["customer_name"]);
-				});
+				if (customer) {
+					frappe.db.get_value('Customer', customer, ["tax_id", "customer_name", "credit_limit", "payment_terms"], function(value) {
+						frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
+						frappe.query_report.set_filter_value('customer_name', value["customer_name"]);
+						frappe.query_report.set_filter_value('credit_limit', value["credit_limit"]);
+						frappe.query_report.set_filter_value('payment_terms', value["payment_terms"]);
+					});
+				} else {
+					frappe.query_report.set_filter_value('tax_id', "");
+					frappe.query_report.set_filter_value('customer_name', "");
+					frappe.query_report.set_filter_value('credit_limit', "");
+					frappe.query_report.set_filter_value('payment_terms', "");
+				}
 			}
 		},
 		{
@@ -60,43 +103,6 @@
 			"options": "Sales Person"
 		},
 		{
-			"fieldtype": "Break",
-		},
-		{
-			"fieldname":"report_date",
-			"label": __("As on Date"),
-			"fieldtype": "Date",
-			"default": frappe.datetime.get_today()
-		},
-		{
-			"fieldname":"ageing_based_on",
-			"label": __("Ageing Based On"),
-			"fieldtype": "Select",
-			"options": 'Posting Date\nDue Date',
-			"default": "Posting Date"
-		},
-		{
-			"fieldname":"range1",
-			"label": __("Ageing Range 1"),
-			"fieldtype": "Int",
-			"default": "30",
-			"reqd": 1
-		},
-		{
-			"fieldname":"range2",
-			"label": __("Ageing Range 2"),
-			"fieldtype": "Int",
-			"default": "60",
-			"reqd": 1
-		},
-		{
-			"fieldname":"range3",
-			"label": __("Ageing Range 3"),
-			"fieldtype": "Int",
-			"default": "90",
-			"reqd": 1
-		},
-		{
 			"fieldname":"show_pdc_in_print",
 			"label": __("Show PDC in Print"),
 			"fieldtype": "Check",
@@ -112,6 +118,18 @@
 			"label": __("Customer Name"),
 			"fieldtype": "Data",
 			"hidden": 1
+		},
+		{
+			"fieldname":"payment_terms",
+			"label": __("Payment Tems"),
+			"fieldtype": "Data",
+			"hidden": 1
+		},
+		{
+			"fieldname":"credit_limit",
+			"label": __("Credit Limit"),
+			"fieldtype": "Currency",
+			"hidden": 1
 		}
 	],
 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 572f81d..8e05a08 100755
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -125,17 +125,22 @@
 		}]
 
 		if args.get('party_type') == 'Customer':
-			columns.append({
-				"label": _("Customer LPO"),
-				"fieldtype": "Data",
-				"fieldname": "po_no",
-				"width": 100,
-			})
-			columns += [_("Delivery Note") + ":Data:100"]
-		if args.get("party_type") == "Customer":
 			columns += [
+				{
+					"label": _("Customer LPO"),
+					"fieldtype": "Data",
+					"fieldname": "po_no",
+					"width": 100,
+				},
+				_("Delivery Note") + ":Data:100",
 				_("Territory") + ":Link/Territory:80",
-				_("Customer Group") + ":Link/Customer Group:120"
+				_("Customer Group") + ":Link/Customer Group:120",
+				{
+					"label": _("Sales Person"),
+					"fieldtype": "Data",
+					"fieldname": "sales_person",
+					"width": 120,
+				}
 			]
 		if args.get("party_type") == "Supplier":
 			columns += [_("Supplier Group") + ":Link/Supplier Group:80"]
@@ -238,7 +243,8 @@
 
 					# customer territory / supplier group
 					if args.get("party_type") == "Customer":
-						row += [self.get_territory(gle.party), self.get_customer_group(gle.party)]
+						row += [self.get_territory(gle.party), self.get_customer_group(gle.party),
+							voucher_details.get(gle.voucher_no, {}).get("sales_person")]
 					if args.get("party_type") == "Supplier":
 						row += [self.get_supplier_group(gle.party)]
 
@@ -395,9 +401,14 @@
 				values.append(self.filters.get("sales_partner"))
 
 			if self.filters.get("sales_person"):
-				conditions.append("""party in (select parent
-					from `tabSales Team` where sales_person=%s and parenttype = 'Customer')""")
-				values.append(self.filters.get("sales_person"))
+				lft, rgt = frappe.db.get_value("Sales Person",
+					self.filters.get("sales_person"), ["lft", "rgt"])
+
+				conditions.append("""exists(select name from `tabSales Team` steam where
+					steam.sales_person in (select name from `tabSales Person` where lft >= {0} and rgt <= {1})
+					and ((steam.parent = voucher_no and steam.parenttype = voucher_type)
+						or (steam.parent = against_voucher and steam.parenttype = against_voucher_type)
+						or (steam.parent = party and steam.parenttype = 'Customer')))""".format(lft, rgt))
 
 		if party_type_field=="supplier":
 			if self.filters.get("supplier_group"):
@@ -550,8 +561,12 @@
 	voucher_details = frappe._dict()
 
 	if party_type == "Customer":
-		for si in frappe.db.sql("""select name, due_date, po_no
-			from `tabSales Invoice` where docstatus=1 and name in (%s)
+		for si in frappe.db.sql("""
+			select inv.name, inv.due_date, inv.po_no, GROUP_CONCAT(steam.sales_person SEPARATOR ', ') as sales_person
+			from `tabSales Invoice` inv
+			left join `tabSales Team` steam on steam.parent = inv.name and steam.parenttype = 'Sales Invoice'
+			where inv.docstatus=1 and inv.name in (%s)
+			group by inv.name
 			""" %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1):
 				si['delivery_note'] = dn_details.get(si.name)
 				voucher_details.setdefault(si.name, si)
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
index 96e5d18..a6f1457 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
@@ -11,25 +11,11 @@
 			"default": frappe.defaults.get_user_default("Company")
 		},
 		{
-			"fieldname":"customer",
-			"label": __("Customer"),
-			"fieldtype": "Link",
-			"options": "Customer"
-		},
-		{
-			"fieldname":"customer_group",
-			"label": __("Customer Group"),
-			"fieldtype": "Link",
-			"options": "Customer Group"
-		},
-		{
-			"fieldname":"payment_terms_template",
-			"label": __("Payment Terms Template"),
-			"fieldtype": "Link",
-			"options": "Payment Terms Template"
-		},
-		{
-			"fieldtype": "Break",
+			"fieldname":"ageing_based_on",
+			"label": __("Ageing Based On"),
+			"fieldtype": "Select",
+			"options": 'Posting Date\nDue Date',
+			"default": "Posting Date"
 		},
 		{
 			"fieldname":"report_date",
@@ -38,13 +24,6 @@
 			"default": frappe.datetime.get_today()
 		},
 		{
-			"fieldname":"ageing_based_on",
-			"label": __("Ageing Based On"),
-			"fieldtype": "Select",
-			"options": 'Posting Date\nDue Date',
-			"default": "Posting Date"
-		},
-		{
 			"fieldname":"range1",
 			"label": __("Ageing Range 1"),
 			"fieldtype": "Int",
@@ -64,6 +43,48 @@
 			"fieldtype": "Int",
 			"default": "90",
 			"reqd": 1
+		},
+		{
+			"fieldname":"finance_book",
+			"label": __("Finance Book"),
+			"fieldtype": "Link",
+			"options": "Finance Book"
+		},
+		{
+			"fieldname":"customer",
+			"label": __("Customer"),
+			"fieldtype": "Link",
+			"options": "Customer"
+		},
+		{
+			"fieldname":"customer_group",
+			"label": __("Customer Group"),
+			"fieldtype": "Link",
+			"options": "Customer Group"
+		},
+		{
+			"fieldname":"payment_terms_template",
+			"label": __("Payment Terms Template"),
+			"fieldtype": "Link",
+			"options": "Payment Terms Template"
+		},
+		{
+			"fieldname":"territory",
+			"label": __("Territory"),
+			"fieldtype": "Link",
+			"options": "Territory"
+		},
+		{
+			"fieldname":"sales_partner",
+			"label": __("Sales Partner"),
+			"fieldtype": "Link",
+			"options": "Sales Partner"
+		},
+		{
+			"fieldname":"sales_person",
+			"label": __("Sales Person"),
+			"fieldtype": "Link",
+			"options": "Sales Person"
 		}
 	],
 
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index 7bf9972..190031a 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
@@ -97,6 +97,12 @@
 				"fieldtype": "Link",
 				"options": "Customer Group",
 				"width": 80
+			},
+			{
+				"label": _("Sales Person"),
+				"fieldtype": "Data",
+				"fieldname": "sales_person",
+				"width": 120,
 			}]
 
 		if args.get("party_type") == "Supplier":
@@ -135,7 +141,7 @@
 			]
 
 			if args.get("party_type") == "Customer":
-				row += [self.get_territory(party), self.get_customer_group(party)]
+				row += [self.get_territory(party), self.get_customer_group(party), ", ".join(set(party_dict.sales_person))]
 			if args.get("party_type") == "Supplier":
 				row += [self.get_supplier_group(party)]
 
@@ -156,15 +162,19 @@
 					"range1": 0,
 					"range2": 0,
 					"range3": 0,
-					"range4": 0
+					"range4": 0,
+					"sales_person": []
 				})
 			)
 			for k in list(party_total[d.party]):
-				if k != "currency":
+				if k not in ["currency", "sales_person"]:
 					party_total[d.party][k] += flt(d.get(k, 0))
 
 			party_total[d.party].currency = d.currency
 
+			if d.sales_person:
+				party_total[d.party].sales_person.append(d.sales_person)
+
 		return party_total
 
 	def get_voucherwise_data(self, party_naming_by, args):
@@ -181,12 +191,13 @@
 			cols += ["bill_no", "bill_date"]
 
 		cols += ["invoiced_amt", "paid_amt", "credit_amt",
-		"outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"]
+		"outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency", "pdc/lc_date", "pdc/lc_ref",
+		"pdc/lc_amount", "remaining_balance"]
 
 		if args.get("party_type") == "Supplier":
 			cols += ["supplier_group", "remarks"]
 		if args.get("party_type") == "Customer":
-			cols += ["territory", "customer_group", "remarks"]
+			cols += ["po_no", "do_no", "territory", "customer_group", "sales_person", "remarks"]
 
 		return self.make_data_dict(cols, voucherwise_data)
 
diff --git a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json
new file mode 100644
index 0000000..ea5a97b
--- /dev/null
+++ b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json
@@ -0,0 +1,30 @@
+{
+ "add_total_row": 1, 
+ "creation": "2018-11-22 16:53:19.167935", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "modified": "2018-11-22 17:40:11.317567", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Trial Balance (Simple)", 
+ "owner": "Administrator", 
+ "prepared_report": 0, 
+ "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account\norder by fiscal_year, company, posting_date, account", 
+ "ref_doctype": "GL Entry", 
+ "report_name": "Trial Balance (Simple)", 
+ "report_type": "Query Report", 
+ "roles": [
+  {
+   "role": "Accounts User"
+  }, 
+  {
+   "role": "Accounts Manager"
+  }, 
+  {
+   "role": "Auditor"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index d9ffced..15996c3 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -1,8 +1,10 @@
 from __future__ import unicode_literals
 from frappe import _
+import frappe
+
 
 def get_data():
-	return [
+	config = [
 		{
 			"label": _("Billing"),
 			"items": [
@@ -25,48 +27,7 @@
 					"type": "doctype",
 					"name": "Payment Entry",
 					"description": _("Bank/Cash transactions against party or for internal transfer")
-				},
-				{
-					"type": "page",
-					"name": "pos",
-					"label": _("POS"),
-					"description": _("Point of Sale")
-				},
-				{
-					"type": "doctype",
-					"name": "Cashier Closing",
-					"description": _("Cashier Closing")
-				},
-				{
-					"type": "doctype",
-					"name": "Auto Repeat",
-					"label": _("Auto Repeat"),
-					"description": _("To make recurring documents")
-				},
-				{
-					"type": "doctype",
-					"name": "Loyalty Program",
-					"label": _("Loyalty Program"),
-					"description": _("To make Customer based incentive schemes.")
-				},
-				{
-					"type": "doctype",
-					"name": "Loyalty Point Entry",
-					"label": _("Loyalty Point Entry"),
-					"description": _("To view logs of Loyalty Points assigned to a Customer.")
-				},
-				{
-					"type": "report",
-					"name": "Accounts Receivable",
-					"doctype": "Sales Invoice",
-					"is_query_report": True
-				},
-				{
-					"type": "report",
-					"name": "Accounts Payable",
-					"doctype": "Purchase Invoice",
-					"is_query_report": True
-				},
+				}
 			]
 
 		},
@@ -93,7 +54,7 @@
 				},
 				{
 					"type": "report",
-					"name":"General Ledger",
+					"name": "General Ledger",
 					"doctype": "GL Entry",
 					"is_query_report": True,
 				},
@@ -123,6 +84,18 @@
 			"items": [
 				{
 					"type": "report",
+					"name": "Accounts Receivable",
+					"doctype": "Sales Invoice",
+					"is_query_report": True
+				},
+				{
+					"type": "report",
+					"name": "Accounts Payable",
+					"doctype": "Purchase Invoice",
+					"is_query_report": True
+				},
+				{
+					"type": "report",
 					"name": "Trial Balance",
 					"doctype": "GL Entry",
 					"is_query_report": True,
@@ -225,49 +198,6 @@
 			]
 		},
 		{
-			"label": _("Goods and Services Tax (GST India)"),
-			"items": [
-				{
-					"type": "doctype",
-					"name": "GST Settings",
-				},
-				{
-					"type": "doctype",
-					"name": "GST HSN Code",
-				},
-				{
-					"type": "report",
-					"name": "GSTR-1",
-					"is_query_report": True
-				},
-				{
-					"type": "report",
-					"name": "GSTR-2",
-					"is_query_report": True
-				},
-				{
-					"type": "report",
-					"name": "GST Sales Register",
-					"is_query_report": True
-				},
-				{
-					"type": "report",
-					"name": "GST Purchase Register",
-					"is_query_report": True
-				},
-				{
-					"type": "report",
-					"name": "GST Itemised Sales Register",
-					"is_query_report": True
-				},
-				{
-					"type": "report",
-					"name": "GST Itemised Purchase Register",
-					"is_query_report": True
-				},
-			]
-		},
-		{
 			"label": _("Budget and Cost Center"),
 			"items": [
 				{
@@ -290,7 +220,7 @@
 					"doctype": "Cost Center"
 				},
 				{
-					"type":"doctype",
+					"type": "doctype",
 					"name": "Monthly Distribution",
 					"description": _("Seasonality for setting budgets, targets etc.")
 				},
@@ -347,29 +277,24 @@
 				},
 				{
 					"type": "doctype",
-					"name": "POS Settings",
-					"description": _("Setup mode of POS (Online / Offline)")
-				},
-				{
-					"type": "doctype",
-					"name": "POS Profile",
-					"label": _("Point-of-Sale Profile"),
-					"description": _("Setup default values for POS Invoices")
-				},
-				{
-					"type": "doctype",
-					"name":"Terms and Conditions",
+					"name": "Terms and Conditions",
 					"label": _("Terms and Conditions Template"),
 					"description": _("Template of terms or contract.")
 				},
 				{
 					"type": "doctype",
-					"name":"Mode of Payment",
+					"name": "Mode of Payment",
 					"description": _("e.g. Bank, Cash, Credit Card")
 				},
 				{
 					"type": "doctype",
-					"name":"C-Form",
+					"name": "Auto Repeat",
+					"label": _("Auto Repeat"),
+					"description": _("To make recurring documents")
+				},
+				{
+					"type": "doctype",
+					"name": "C-Form",
 					"description": _("C-Form records"),
 					"country": "India"
 				}
@@ -506,12 +431,12 @@
 			"items": [
 				{
 					"type": "doctype",
-					"name":"Shareholder",
+					"name": "Shareholder",
 					"description": _("List of available Shareholders with folio numbers")
 				},
 				{
 					"type": "doctype",
-					"name":"Share Transfer",
+					"name": "Share Transfer",
 					"description": _("List of all share transactions"),
 				},
 				{
@@ -529,28 +454,6 @@
 			]
 		},
 		{
-			"label": _("Subscription Management"),
-			"icon": "fa fa-microchip ",
-			"items": [
-				{
-					"type": "doctype",
-					"name":"Subscriber",
-				},
-				{
-					"type": "doctype",
-					"name":"Subscription Plan",
-				},
-				{
-					"type": "doctype",
-					"name":"Subscription"
-				},
-				{
-					"type": "doctype",
-					"name": "Subscription Settings"
-				}
-			]
-		},
-		{
 			"label": _("Help"),
 			"icon": "fa fa-facetime-video",
 			"items": [
@@ -572,3 +475,121 @@
 			]
 		}
 	]
+	gst = {
+		"label": _("Goods and Services Tax (GST India)"),
+		"items": [
+			{
+				"type": "doctype",
+				"name": "GST Settings",
+			},
+			{
+				"type": "doctype",
+				"name": "GST HSN Code",
+			},
+			{
+				"type": "report",
+				"name": "GSTR-1",
+				"is_query_report": True
+			},
+			{
+				"type": "report",
+				"name": "GSTR-2",
+				"is_query_report": True
+			},
+			{
+				"type": "report",
+				"name": "GST Sales Register",
+				"is_query_report": True
+			},
+			{
+				"type": "report",
+				"name": "GST Purchase Register",
+				"is_query_report": True
+			},
+			{
+				"type": "report",
+				"name": "GST Itemised Sales Register",
+				"is_query_report": True
+			},
+			{
+				"type": "report",
+				"name": "GST Itemised Purchase Register",
+				"is_query_report": True
+			},
+		]
+	}
+	retail = {
+		"label": _("Retail Operations"),
+		"items": [
+			{
+				"type": "page",
+				"name": "pos",
+				"label": _("POS"),
+				"description": _("Point of Sale")
+			},
+			{
+				"type": "doctype",
+				"name": "Cashier Closing",
+				"description": _("Cashier Closing")
+			},
+			{
+				"type": "doctype",
+				"name": "POS Settings",
+				"description": _("Setup mode of POS (Online / Offline)")
+			},
+			{
+				"type": "doctype",
+				"name": "POS Profile",
+				"label": _("Point-of-Sale Profile"),
+				"description": _("Setup default values for POS Invoices")
+			},
+			{
+				"type": "doctype",
+				"name": "Loyalty Program",
+				"label": _("Loyalty Program"),
+				"description": _("To make Customer based incentive schemes.")
+			},
+			{
+				"type": "doctype",
+				"name": "Loyalty Point Entry",
+				"label": _("Loyalty Point Entry"),
+				"description": _("To view logs of Loyalty Points assigned to a Customer.")
+			}
+		]
+	}
+	subscriptions = {
+		"label": _("Subscription Management"),
+		"icon": "fa fa-microchip ",
+		"items": [
+			{
+				"type": "doctype",
+				"name": "Subscriber",
+			},
+			{
+				"type": "doctype",
+				"name": "Subscription Plan",
+			},
+			{
+				"type": "doctype",
+				"name": "Subscription"
+			},
+			{
+				"type": "doctype",
+				"name": "Subscription Settings"
+			}
+		]
+	}
+	countries = frappe.get_all("Company", fields="country")
+	countries = [country["country"] for country in countries]
+	if "India" in countries:
+		config.insert(7, gst)
+	domains = frappe.get_active_domains()
+	if "Retail" in domains:
+		config.insert(2, retail)
+	else:
+		config.insert(7, retail)
+	if "Services" in domains:
+		config.insert(2, subscriptions)
+	else:
+		config.insert(7, subscriptions)
+	return config
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index c1bb41b..bed2986 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -12,7 +12,7 @@
 source_link = "https://github.com/frappe/erpnext"
 
 develop_version = '12.x.x-develop'
-staging_version = '11.0.3-beta.26'
+staging_version = '11.0.3-beta.29'
 
 error_report_email = "support@erpnext.com"
 
diff --git a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
index 9a0c5f7..bf150b1 100644
--- a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
+++ b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
@@ -78,12 +78,17 @@
 	total_pro_rata_max = 0
 	benefit_amount_total = 0
 	for sal_struct_row in sal_struct.get("earnings"):
-		pay_against_benefit_claim, max_benefit_amount = frappe.db.get_value("Salary Component", sal_struct_row.salary_component, ["pay_against_benefit_claim", "max_benefit_amount"])
+		try:
+			pay_against_benefit_claim, max_benefit_amount = frappe.db.get_value("Salary Component", sal_struct_row.salary_component, ["pay_against_benefit_claim", "max_benefit_amount"])
+		except TypeError:
+			# show the error in tests?
+			frappe.throw("Unable to find Salary Component {0}".format(sal_struct_row.salary_component))
 		if sal_struct_row.is_flexible_benefit == 1 and pay_against_benefit_claim != 1:
 			total_pro_rata_max += max_benefit_amount
 	if total_pro_rata_max > 0:
 		for sal_struct_row in sal_struct.get("earnings"):
 			pay_against_benefit_claim, max_benefit_amount = frappe.db.get_value("Salary Component", sal_struct_row.salary_component, ["pay_against_benefit_claim", "max_benefit_amount"])
+
 			if sal_struct_row.is_flexible_benefit == 1 and pay_against_benefit_claim != 1:
 				component_max = max_benefit_amount
 				benefit_amount = component_max * sal_struct.max_benefits / total_pro_rata_max
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 208a733..079bec5 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -256,6 +256,9 @@
 			raise
 		frappe.db.sql("""delete from `tabAdditional Salary` where employee=%s""", (employee))
 
+		# undelete fixture data
+		frappe.db.rollback()
+
 	def make_holiday_list(self):
 		fiscal_year = get_fiscal_year(nowdate(), company=erpnext.get_default_company())
 		if not frappe.db.get_value("Holiday List", "Salary Slip Test Holiday List"):
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py
index 81c5eb9..bc74535 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card.py
@@ -110,7 +110,7 @@
 
 		if self.items:
 			self.transferred_qty = frappe.db.get_value('Stock Entry', {'job_card': self.name,
-				'work_order': self.work_order, 'docstatus': 1}, 'sum(fg_completed_qty)')
+				'work_order': self.work_order, 'docstatus': 1}, 'sum(fg_completed_qty)') or 0
 
 		self.db_set("transferred_qty", self.transferred_qty)
 
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index 40b065d..faa445a 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -120,28 +120,3 @@
 		frm.trigger('tasks_refresh');
 	},
 });
-
-frappe.ui.form.on("Project", "validate", function (frm) {
-	if (frm.doc.collect_progress == 1) {
-		frappe.call({
-			method: "erpnext.projects.doctype.project.project.times_check",
-			args: {
-				"from1": frm.doc.from,
-				"to": frm.doc.to,
-				"first_email": frm.doc.first_email,
-				"second_email": frm.doc.second_email,
-				"daily_time_to_send": frm.doc.daily_time_to_send,
-				"weekly_time_to_send": frm.doc.weekly_time_to_send
-
-			},
-			callback: function (r) {
-				frm.set_value("from", r.message.from1);
-				frm.set_value("to", r.message.to);
-				frm.set_value("first_email", r.message.first_email);
-				frm.set_value("second_email", r.message.second_email);
-				frm.set_value("daily_time_to_send", r.message.daily_time_to_send);
-				frm.set_value("weekly_time_to_send", r.message.weekly_time_to_send);
-			}
-		});
-	}
-});
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index ff69870..942593a 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -427,23 +427,6 @@
 	project = frappe.db.sql("""SELECT `tabProject User`.user FROM `tabProject User` INNER JOIN `tabProject` ON `tabProject`.project_name = `tabProject User`.parent WHERE (`tabProject`.frequency = "Weekly") AND (`tabProject`.day_to_send = %s) AND (`tabProject`.weekly_time_to_send BETWEEN DATE_ADD(curtime(), INTERVAL -15 MINUTE) AND DATE_ADD(curtime(), INTERVAL 15 MINUTE)) AND `tabProject`.collect_progress = 1""", today)
 	create_project_update(project)
 
-@frappe.whitelist()
-def times_check(from1, to, first_email, second_email, daily_time_to_send, weekly_time_to_send):
-    from1 = datetime.datetime.strptime(from1, "%H:%M:%S.%f")
-    from1 = from1.strftime("%H:00:00")
-    to = datetime.datetime.strptime(to, "%H:%M:%S.%f")
-    to = to.strftime("%H:00:00")
-    first_email = datetime.datetime.strptime(first_email, "%H:%M:%S.%f")
-    first_email = first_email.strftime("%H:00:00")
-    second_email = datetime.datetime.strptime(second_email, "%H:%M:%S.%f")
-    second_email = second_email.strftime("%H:00:00")
-    daily_time_to_send = datetime.datetime.strptime(daily_time_to_send, "%H:%M:%S.%f")
-    daily_time_to_send = daily_time_to_send.strftime("%H:00:00")
-    weekly_time_to_send = datetime.datetime.strptime(weekly_time_to_send, "%H:%M:%S.%f")
-    weekly_time_to_send = weekly_time_to_send.strftime("%H:00:00")
-    return {"from1": from1, "to": to, "first_email": first_email, "second_email": second_email,"daily_time_to_send": daily_time_to_send, "weekly_time_to_send": weekly_time_to_send}
-
-
 #Call this function in order to generate the Project Update for a specific project
 def create_project_update(project):
 	data = []
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index e293321..dc989e2 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -120,7 +120,7 @@
 					);
 				});
 			}
-			else {
+			else if (company_wise_info.length === 1) {
 				frm.dashboard.stats_area.removeClass('hidden');
 				frm.dashboard.stats_area_row.append(
 					'</div><div class="col-xs-6 small" style="margin-bottom:10px">Annual Billing: <b>'
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index c708de0..6f7bfb3 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -206,7 +206,7 @@
 
 }
 
-frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt, cdn) {
+frappe.ui.form.on("Quotation Item", "items_on_form_rendered", "packed_items_on_form_rendered", function(frm, cdt, cdn) {
 	// enable tax_amount field if Actual
 })
 
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index daec5b5..56d9151 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -125,6 +125,8 @@
 	if batch_no_data:
 		return batch_no_data
 
+	return {}
+
 def get_conditions(item_code, serial_no, batch_no, barcode):
 	if serial_no or batch_no or barcode:
 		return frappe.db.escape(item_code), "i.name = %(item_code)s"
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 9a15484..f8a3497 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -223,6 +223,10 @@
 		erpnext.setup_serial_no();
 	},
 
+	packed_items_on_form_rendered: function(doc, grid_row) {
+		erpnext.setup_serial_no();
+	},
+
 	close_delivery_note: function(doc){
 		this.update_status("Closed")
 	},
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 5fd7a6a..2b0ed38 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -102,7 +102,7 @@
 
 	update_status: function(frm, stop_status) {
 		frappe.call({
-			method: 'erpnext.stock.material_request.material_request.update_status',
+			method: 'erpnext.stock.doctype.material_request.material_request.update_status',
 			args: { name: frm.doc.name, status: stop_status },
 			callback(r) {
 				if (!r.exc) {