Merge branch 'develop' into refactor/stock/reports
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/unverified/at_austria_chart_template.json b/erpnext/accounts/doctype/account/chart_of_accounts/unverified/at_austria_chart_template.json
index 3b07d51..58d67be 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/unverified/at_austria_chart_template.json
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/unverified/at_austria_chart_template.json
@@ -2,397 +2,438 @@
     "country_code": "at",
     "name": "Austria - Chart of Accounts",
     "tree": {
-        "Summe Abschreibungen und Aufwendungen": {
-            "7010 bis 7080 Abschreibungen auf das Anlageverm\u00f6gen (ausgenommen Finanzanlagen)": {},
-            "7100 bis 7190 Sonstige Steuern": {
-                "account_type": "Tax"
-            },
-            "7200 bis 7290 Instandhaltung u. Reinigung durh Dritte, Entsorgung, Beleuchtung": {},
-            "7300 bis 7310 Transporte durch Dritte": {},
-            "7320 bis 7330 Kfz - Aufwand": {},
-            "7340 bis 7350 Reise- und Fahraufwand": {},
-            "7360 bis 7370 Tag- und N\u00e4chtigungsgelder": {},
-            "7380 bis 7390 Nachrichtenaufwand": {},
-            "7400 bis 7430 Miet- und Pachtaufwand": {},
-            "7440 bis 7470 Leasingaufwand": {},
-            "7480 bis 7490 Lizenzaufwand": {},
-            "7500 bis 7530 Aufwand f\u00fcr beigestelltes Personal": {},
-            "7540 bis 7570 Provisionen an Dritte": {},
-            "7580 bis 7590 Aufsichtsratsverg\u00fctungen": {},
-            "7610 bis 7620 Druckerzeugnisse und Vervielf\u00e4ltigungen": {},
-            "7650 bis 7680 Werbung und Repr\u00e4sentationen": {},
-            "7700 bis 7740 Versicherungen": {},
-            "7750 bis 7760 Beratungs- und Pr\u00fcfungsaufwand": {},
-            "7800 bis 7810 Schadensf\u00e4lle": {},
-            "7840 bis 7880 Verschiedene betriebliche Aufwendungen": {},
-            "7910 bis 7950 Aufwandsstellenrechung der Hersteller": {},
-            "Abschreibungen auf aktivierte Aufwendungen f\u00fcr das Ingangs. u. Erweitern des Betriebes": {},
-            "Abschreibungen vom Umlaufverm\u00f6gen, soweit diese die im Unternehmen \u00fcblichen Abschreibungen \u00fcbersteigen": {},
-            "Aufwandsstellenrechnung": {},
-            "Aus- und Fortbildung": {},
-            "Buchwert abgegangener Anlagen, ausgenommen Finanzanlagen": {},
-            "B\u00fcromaterial und Drucksorten": {},
-            "Fachliteratur und Zeitungen ": {},
-            "Herstellungskosten der zur Erzielung der Umsatzerl\u00f6se erbrachten Leistungen": {},
-            "Mitgliedsbeitr\u00e4ge": {},
-            "Skontoertr\u00e4ge auf sonstige betriebliche Aufwendungen": {},
-            "Sonstige betrieblichen Aufwendungen": {},
-            "Spenden und Trinkgelder": {},
-            "Spesen des Geldverkehrs": {},
-            "Verluste aus dem Abgang vom Anlageverm\u00f6gen, ausgenommen Finanzanlagen": {},
-            "Vertriebskosten": {},
-            "Verwaltungskosten": {},
-            "root_type": "Expense"
-        },
-        "Summe Betriebliche Ertr\u00e4ge": {
-            "4400 bis 4490 Erl\u00f6sschm\u00e4lerungen": {},
-            "4500 bis 4570 Ver\u00e4nderungen des Bestandes an fertigen und unfertigen Erzeugn. sowie an noch nicht abrechenbaren Leistungen": {},
-            "4580 bis 4590 andere aktivierte Eigenleistungen": {},
-            "4600 bis 4620 Erl\u00f6se aus dem Abgang vom Anlageverm\u00f6gen, ausgen. Finanzanlagen": {},
-            "4630 bis 4650 Ertr\u00e4ge aus dem Abgang vom Anlageverm\u00f6gen, ausgen. Finanzanlagen": {},
-            "4660 bis 4670 Ertr\u00e4ge aus der Zuschreibung zum Anlageverm\u00f6gen, ausgen. Finanzanlagen": {},
-            "4700 bis 4790 Ertr\u00e4ge aus der Aufl\u00f6sung von R\u00fcckstellungen": {},
-            "4800 bis 4990 \u00dcbrige betriebliche Ertr\u00e4ge": {},
-            "Erl\u00f6se 0 % Ausfuhrlieferungen/Drittl\u00e4nder": {},
-            "Erl\u00f6se 10 %": {},
-            "Erl\u00f6se 20 %": {},
-            "Erl\u00f6se aus im Inland stpfl. EG Lieferungen 10 % USt": {},
-            "Erl\u00f6se aus im Inland stpfl. EG Lieferungen 20 % USt": {},
-            "Erl\u00f6se i.g. Lieferungen (stfr)": {},
-            "root_type": "Income"
-        },
-        "Summe Eigenkapital R\u00fccklagen Abschlusskonten": {
-            "9000 bis 9180 Gezeichnetes bzw. gewidmetes Kapital": {
-                "account_type": "Equity"
-            },
-            "9200 bis 9290 Kapitalr\u00fccklagen": {
-                "account_type": "Equity"
-            },
-            "9300 bis 9380 Gewinnr\u00fccklagen": {
-                "account_type": "Equity"
-            },
-            "9400 bis 9590 Bewertungsreserven uns sonst. unversteuerte R\u00fccklagen": {
-                "account_type": "Equity"
-            },
-            "9600 bis 9690 Privat und Verrechnungskonten bei Einzelunternehmen und Personengesellschaften": {},
-            "9700 bis 9790 Einlagen stiller Gesellschafter ": {},
-            "9900 bis 9999 Evidenzkonten": {},
-            "Bilanzgewinn (-verlust )": {
-                "account_type": "Equity"
-            },
-            "Er\u00f6ffnungsbilanz": {},
-            "Gewinn- und Verlustrechnung": {},
-            "Schlussbilanz": {},
-            "nicht eingeforderte ausstehende Einlagen": {
-                "account_type": "Equity"
-            },
-            "root_type": "Equity"
-        },
-        "Summe Finanzertr\u00e4ge und Aufwendungen": {
-            "8000 bis 8040 Ertr\u00e4ge aus Beteiligungen": {},
-            "8050 bis 8090 Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": {},
-            "8100 bis 8130 Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge": {},
-            "8220 bis 8250 Aufwendungen aus Beteiligungen": {},
-            "8260 bis 8270 Aufwendungen aus sonst. Fiananzanlagen und aus Wertpapieren des Umlaufverm\u00f6gens": {},
-            "8280 bis 8340 Zinsen und \u00e4hnliche Aufwendungem": {},
-            "8400 bis 8440 Au\u00dferordentliche Ertr\u00e4ge": {},
-            "8450 bis 8490 Au\u00dferordentliche Aufwendungen": {},
-            "8500 bis 8590 Steuern vom Einkommen und vom Ertrag": {
-                "account_type": "Tax"
-            },
-            "8600 bis 8690 Aufl\u00f6sung unversteuerten R\u00fccklagen": {},
-            "8700 bis 8740 Aufl\u00f6sung von Kapitalr\u00fccklagen": {},
-            "8750 bis 8790 Aufl\u00f6sung von Gewinnr\u00fccklagen": {},
-            "8800 bis 8890 Zuweisung von unversteuerten R\u00fccklagen": {},
-            "Buchwert abgegangener Beteiligungen": {},
-            "Buchwert abgegangener Wertpapiere des Umlaufverm\u00f6gens": {},
-            "Buchwert abgegangener sonstiger Finanzanlagen": {},
-            "Erl\u00f6se aus dem Abgang von Beteiligungen": {},
-            "Erl\u00f6se aus dem Abgang von Wertpapieren des Umlaufverm\u00f6gens": {},
-            "Erl\u00f6se aus dem Abgang von sonstigen Finanzanlagen": {},
-            "Ertr\u00e4ge aus dem Abgang von und der Zuschreibung zu Finanzanlagen": {},
-            "Ertr\u00e4ge aus dem Abgang von und der Zuschreibung zu Wertpapieren des Umlaufverm\u00f6gens": {},
-            "Gewinabfuhr bzw. Verlust\u00fcberrechnung aus Ergebnisabf\u00fchrungsvertr\u00e4gen": {},
-            "nicht ausgenutzte Lieferantenskonti": {},
-            "root_type": "Income"
-        },
-        "Summe Fremdkapital": {
-            "3020 bis 3030 Steuerr\u00fcckstellungen": {},
-            "3040 bis 3090 Sonstige R\u00fcckstellungen": {},
-            "3110 bis 3170 Verbindlichkeiten gegen\u00fcber Kredidinstituten": {},
-            "3180 bis 3190 Verbindlichkeiten gegen\u00fcber Finanzinstituten": {},
-            "3380 bis 3390 Verbindlichkeiten aus der Annahme gezogener Wechsel u. d. Ausstellungen eigener Wechsel": {
+        "Klasse 0 Aktiva: Anlageverm\u00f6gen": {
+				"0100 Konzessionen ": {"account_type": "Fixed Asset"},
+				"0110 Patentrechte und Lizenzen ": {"account_type": "Fixed Asset"},
+				"0120 Datenverarbeitungsprogramme ": {"account_type": "Fixed Asset"},
+				"0130 Marken, Warenzeichen und Musterschutzrechte, sonstige Urheberrechte ": {"account_type": "Fixed Asset"},
+				"0140 Pacht- und Mietrechte ": {"account_type": "Fixed Asset"},
+				"0150 Bezugs- und ähnliche Rechte ": {"account_type": "Fixed Asset"},
+				"0160 Geschäfts-/Firmenwert ": {"account_type": "Fixed Asset"},
+				"0170 Umgründungsmehrwert ": {"account_type": "Fixed Asset"},
+				"0180 Geleistete Anzahlungen auf immaterielle Vermögensgegenstände": {"account_type": "Fixed Asset"},
+				"0190 Kumulierte Abschreibungen zu immateriellen Vermögensgegenständen ": {"account_type": "Fixed Asset"},
+				"0200 Unbebaute Grundstücke, soweit nicht landwirtschaftlich genutzt ": {"account_type": "Fixed Asset"},
+				"0210 Bebaute Grundstücke (Grundwert) ": {"account_type": "Fixed Asset"},
+				"0220 Landwirtschaftlich genutzte Grundstücke ": {"account_type": "Fixed Asset"},
+				"0230 Grundstücksgleiche Rechte ": {"account_type": "Fixed Asset"},
+				"0300 Betriebs- und Geschäftsgebäude auf eigenem Grund ": {"account_type": "Fixed Asset"},
+				"0310 Wohn- und Sozialgebäude auf eigenem Grund ": {"account_type": "Fixed Asset"},
+				"0320 Betriebs- und Geschäftsgebäude auf fremdem Grund ": {"account_type": "Fixed Asset"},
+				"0330 Wohn- und Sozialgebäude auf fremdem Grund ": {"account_type": "Fixed Asset"},
+				"0340 Grundstückseinrichtungen auf eigenem Grund ": {"account_type": "Fixed Asset"},
+				"0350 Grundstückseinrichtungen auf fremdem Grund ": {"account_type": "Fixed Asset"},
+				"0360 Bauliche Investitionen in fremden (gepachteten) Betriebs- und Geschäftsgebäuden": {"account_type": "Fixed Asset"},
+				"0370 Bauliche Investitionen in fremden (gepachteten) Wohn- und Sozialgebäuden": {"account_type": "Fixed Asset"},
+				"0390 Kumulierte Abschreibungen zu Grundstücken ": {"account_type": "Fixed Asset"},
+				"0400 Maschinen und Geräte ": {"account_type": "Fixed Asset"},				
+				"0500 Maschinenwerkzeuge ": {"account_type": "Fixed Asset"},
+				"0510 Allgemeine Werkzeuge und Handwerkzeuge ": {"account_type": "Fixed Asset"},
+				"0520 Prototypen, Formen, Modelle ": {"account_type": "Fixed Asset"},
+				"0530 Andere Erzeugungshilfsmittel (auch Softwarewerkzeuge)": {"account_type": "Fixed Asset"},
+				"0540 Hebezeuge und Montageanlagen ": {"account_type": "Fixed Asset"},
+				"0550 Geringwertige Vermögensgegenstände, soweit im Erzeugungsprozess ": {"account_type": "Fixed Asset"},
+				"0560 Festwerte technische Anlagen und Maschinen ": {"account_type": "Fixed Asset"},
+				"0590 Kumulierte Abschreibungen zu technischen Anlagen und Maschinen ": {"account_type": "Fixed Asset"},
+				"0600 Betriebs- und Geschäftsausstattung, soweit nicht gesondert angeführt ": {"account_type": "Fixed Asset"},
+				"0610 Andere Anlagen, soweit nicht gesondert angeführt ": {"account_type": "Fixed Asset"},
+				"0620 Büromaschinen, EDV-Anlagen ": {"account_type": "Fixed Asset"},
+				"0630 PKW und Kombis ": {"account_type": "Fixed Asset"},
+				"0640 LKW ": {"account_type": "Fixed Asset"},
+				"0650 Andere Beförderungsmittel ": {"account_type": "Fixed Asset"},
+				"0660 Gebinde ": {"account_type": "Fixed Asset"},
+				"0670 Geringwertige Vermögensgegenstände, soweit nicht im Erzeugungssprozess verwendet": {"account_type": "Fixed Asset"},
+				"0680 Festwerte außer technische Anlagen und Maschinen ": {"account_type": "Fixed Asset"},
+				"0690 Kumulierte Abschreibungen zu anderen Anlagen, Betriebs- und Geschäftsausstattung": {"account_type": "Fixed Asset"},
+				"0700 Geleistete Anzahlungen auf Sachanlagen ": {"account_type": "Fixed Asset"},
+				"0710 Anlagen in Bau ": {"account_type": "Fixed Asset"},
+				"0790 Kumulierte Abschreibungen zu geleisteten Anzahlungen auf Sachanlagen ": {"account_type": "Fixed Asset"},
+				"0800 Anteile an verbundenen Unternehmen ": {"account_type": "Fixed Asset"},
+				"0810 Beteiligungen an Gemeinschaftsunternehmen ": {"account_type": "Fixed Asset"},
+				"0820 Beteiligungen an angeschlossenen (assoziierten) Unternehmen ": {"account_type": "Fixed Asset"},
+				"0830 Eigene Anteile, Anteile an herrschenden oder mit Mehrheit beteiligten ": {"account_type": "Fixed Asset"},
+				"0840 Sonstige Beteiligungen ": {"account_type": "Fixed Asset"},
+				"0850 Ausleihungen an verbundene Unternehmen ": {"account_type": "Fixed Asset"},
+				"0860 Ausleihungen an Unternehmen mit Beteiligungsverhältnis": {"account_type": "Fixed Asset"},
+				"0870 Ausleihungen an Gesellschafter ": {"account_type": "Fixed Asset"},
+				"0880 Sonstige Ausleihungen ": {"account_type": "Fixed Asset"},
+				"0890 Anteile an Kapitalgesellschaften ohne Beteiligungscharakter ": {"account_type": "Fixed Asset"},
+				"0900 Anteile an Personengesellschaften ohne Beteiligungscharakter ": {"account_type": "Fixed Asset"},
+				"0910 Genossenschaftsanteile ohne Beteiligungscharakter ": {"account_type": "Fixed Asset"},
+				"0920 Anteile an Investmentfonds ": {"account_type": "Fixed Asset"},
+				"0930 Festverzinsliche Wertpapiere des Anlagevermögens ": {"account_type": "Fixed Asset"},
+				"0980 Geleistete Anzahlungen auf Finanzanlagen ": {"account_type": "Fixed Asset"},
+				"0990 Kumulierte Abschreibungen zu Finanzanlagen ": {"account_type": "Fixed Asset"},
+            "root_type": "Asset"
+        },    
+        "Klasse 1 Aktiva: Vorr\u00e4te": {
+            "1000 Bezugsverrechnung": {"account_type": "Stock"},
+            "1100 Rohstoffe": {"account_type": "Stock"},
+            "1200 Bezogene Teile": {"account_type": "Stock"},
+            "1300 Hilfsstoffe": {"account_type": "Stock"},
+            "1350 Betriebsstoffe": {"account_type": "Stock"},
+            "1360 Vorrat Energietraeger": {"account_type": "Stock"},            
+            "1400 Unfertige Erzeugnisse": {"account_type": "Stock"},
+            "1500 Fertige Erzeugnisse": {"account_type": "Stock"},
+            "1600 Handelswarenvorrat": {"account_type": "Stock Received But Not Billed"},
+            "1700 Noch nicht abrechenbare Leistungen": {"account_type": "Stock"},
+            "1900 Wertberichtigungen": {"account_type": "Stock"},
+            "1800 Geleistete Anzahlungen": {"account_type": "Stock"},
+            "1900 Wertberichtigungen": {"account_type": "Stock"},
+            "root_type": "Asset"
+        },    
+        "Klasse 3 Passiva: Verbindlichkeiten": {
+            "3000 Allgemeine Verbindlichkeiten (Schuld)": {"account_type": "Payable"},
+            "3010 R\u00fcckstellungen f\u00fcr Pensionen": {"account_type": "Payable"},
+            "3020 Steuerr\u00fcckstellungen": {"account_type": "Tax"},
+            "3041 Sonstige R\u00fcckstellungen": {"account_type": "Payable"},            
+            "3110 Verbindlichkeiten gegen\u00fcber Bank": {"account_type": "Payable"},
+            "3150 Verbindlichkeiten Darlehen": {"account_type": "Payable"},
+            "3185 Verbindlichkeiten Kreditkarte": {"account_type": "Payable"},            
+            "3380 Verbindlichkeiten aus der Annahme gezogener Wechsel u. d. Ausstellungen eigener Wechsel": {
                 "account_type": "Payable"
             },
-            "3400 bis 3470 Verbindlichkeiten gegen\u00fc. verb. Untern., Verbindl. gegen\u00fc. Untern., mit denen eine Beteiligungsverh\u00e4lnis besteht": {},
-            "3600 bis 3690 Verbindlichkeiten im Rahmen der sozialen Sicherheit": {},
-            "3700 bis 3890 \u00dcbrige sonstige Verbindlichkeiten": {},
-            "3900 bis 3990 Passive Rechnungsabgrenzungsposten": {},
-            "Anleihen (einschlie\u00dflich konvertibler)": {},
-            "Erhaltene Anzahlungenauf Bestellungen": {},
-            "R\u00fcckstellungen f\u00fcr Abfertigung": {},
-            "R\u00fcckstellungen f\u00fcr Pensionen": {},
-            "USt. \u00a719 /art (reverse charge)": {
+            "3400 Verbindlichkeiten gegen\u00fc. verb. Untern., Verbindl. gegen\u00fc. Untern., mit denen eine Beteiligungsverh\u00e4lnis besteht": {},
+            "3460 Verbindlichkeiten gegenueber Gesellschaftern": {"account_type": "Payable"},
+            "3470 Einlagen stiller Gesellschafter": {"account_type": "Payable"},
+            "3585 Verbindlichkeiten Lohnsteuer": {"account_type": "Tax"},             
+            "3590 Verbindlichkeiten Kommunalabgaben": {"account_type": "Tax"},  
+            "3595 Verbindlichkeiten Dienstgeberbeitrag": {"account_type": "Tax"},                       
+            "3600 Verbindlichkeiten Sozialversicherung": {"account_type": "Payable"},
+            "3640 Verbindlichkeiten Loehne und Gehaelter": {"account_type": "Payable"},            
+            "3700 Sonstige Verbindlichkeiten": {"account_type": "Payable"},
+            "3900 Passive Rechnungsabgrenzungsposten": {"account_type": "Payable"},
+            "3100 Anleihen (einschlie\u00dflich konvertibler)": {"account_type": "Payable"},
+            "3200 Erhaltene Anzahlungen auf Bestellungen": {"account_type": "Payable"},
+            "3040 R\u00fcckstellungen f\u00fcr Abfertigung": {"account_type": "Payable"},
+
+            "3530 USt. \u00a719 (reverse charge)": {
                 "account_type": "Tax"
             },
-            "Umsatzsteuer": {},
-            "Umsatzsteuer Zahllast": {
+            "3500 Verbindlichkeiten aus Umsatzsteuer": {"account_type": "Tax"},
+            "3580 Umsatzsteuer Zahllast": {
                 "account_type": "Tax"
             },
-            "Umsatzsteuer aus i.g. Erwerb 10%": {
+            "3510 Umsatzsteuer Inland 20%": {
                 "account_type": "Tax"
             },
-            "Umsatzsteuer aus i.g. Erwerb 20%": {
+            "3515 Umsatzsteuer Inland 10%": {
+                "account_type": "Tax"
+            },            
+            "3520 Umsatzsteuer aus i.g. Erwerb 20%": {
                 "account_type": "Tax"
             },
-            "Umsatzsteuer aus i.g. Lieferungen 10%": {
+            "3525 Umsatzsteuer aus i.g. Erwerb 10%": {
                 "account_type": "Tax"
-            },
-            "Umsatzsteuer aus i.g. Lieferungen 20%": {
-                "account_type": "Tax"
-            },
-            "Umsatzsteuer-Evidenzkonto f\u00fcr erhaltene Anzahlungen auf Bestellungen": {},
-            "Verbindlichkeiten aus Lieferungen u. Leistungen EU": {
+            },            
+            "3560 Umsatzsteuer-Evidenzkonto f\u00fcr erhaltene Anzahlungen auf Bestellungen": {},
+            "3360 Verbindlichkeiten aus Lieferungen u. Leistungen EU": {
                 "account_type": "Payable"
             },
-            "Verbindlichkeiten aus Lieferungen u. Leistungen Inland": {
+            "3000 Verbindlichkeiten aus Lieferungen u. Leistungen Inland": {
                 "account_type": "Payable"
             },
-            "Verbindlichkeiten aus Lieferungen u. Leistungen sonst. Ausland": {
+            "3370 Verbindlichkeiten aus Lieferungen u. Leistungen sonst. Ausland": {
                 "account_type": "Payable"
             },
-            "Verbindlichkeiten gegen\u00fcber Gesellschaften": {},
-            "Verrechnung Finanzamt": {
+            "3400 Verbindlichkeiten gegen\u00fcber verbundenen Unternehmen": {},
+            "3570 Verrechnung Finanzamt": {
                 "account_type": "Tax"
             },
             "root_type": "Liability"
-        },
-        "Summe Kontoklasse 0 Anlageverm\u00f6gen": {
-            "44 bis 49 Sonstige Maschinen und maschinelle Anlagen": {},
-            "920 bis 930 Festverzinsliche Wertpapiere des Anlageverm\u00f6gens": {},
-            "940 bis 970 Sonstige Finanzanlagen, Wertrechte": {},
-            "Allgemeine Werkzeuge und Handwerkzeuge": {},
-            "Andere Bef\u00f6rderungsmittel": {},
-            "Andere Betriebs- und Gesch\u00e4ftsausstattung": {},
-            "Andere Erzeugungshilfsmittel": {},
-            "Anlagen im Bau": {},
-            "Anteile an Investmentfonds": {},
-            "Anteile an Kapitalgesellschaften ohne Beteiligungscharakter": {},
-            "Anteile an Personengesellschaften ohne Beteiligungscharakter": {},
-            "Anteile an verbundenen Unternehmen": {},
-            "Antriebsmaschinen": {},
-            "Aufwendungen f\u00fcs das Ingangssetzen u. Erweitern eines Betriebes": {},
-            "Ausleihungen an  verbundene Unternehmen": {},
-            "Ausleihungen an  verbundene Unternehmen, mit denen ein Beteiligungsverh\u00e4lnis besteht": {},
-            "Bauliche Investitionen in fremden (gepachteten) Betriebs- und Gesch\u00e4ftsgeb\u00e4uden": {},
-            "Bauliche Investitionen in fremden (gepachteten) Wohn- und Sozialgeb\u00e4uden": {},
-            "Bebaute Grundst\u00fccke (Grundwert)": {},
-            "Beheizungs- und Beleuchtungsanlagen": {},
-            "Beteiligungen an Gemeinschaftunternehmen": {},
-            "Beteiligungen an angeschlossenen (assoziierten) Unternehmen": {},
-            "Betriebs- und Gesch\u00e4ftsgeb\u00e4ude auf eigenem Grund": {},
-            "Betriebs- und Gesch\u00e4ftsgeb\u00e4ude auf fremdem Grund": {},
-            "B\u00fcromaschinen, EDV - Anlagen": {},
-            "Datenverarbeitungsprogramme": {},
-            "Energieversorgungsanlagen": {},
-            "Fertigungsmaschinen": {},
-            "Gebinde": {},
-            "Geleistete Anzahlungen": {},
-            "Genossenschaften ohne Beteiligungscharakter": {},
-            "Geringwertige Verm\u00f6gensgegenst\u00e4nde, soweit im Erzeugerprozess verwendet": {},
-            "Geringwertige Verm\u00f6gensgegenst\u00e4nde, soweit nicht im Erzeugungsprozess verwendet": {},
-            "Gesch\u00e4fts(Firmen)wert": {},
-            "Grundst\u00fcckseinrichtunten auf eigenem Grund": {},
-            "Grundst\u00fcckseinrichtunten auf fremdem Grund": {},
-            "Grundst\u00fccksgleiche Rechte": {},
-            "Hebezeuge und Montageanlagen": {},
-            "Konzessionen": {},
-            "Kumulierte Abschreibungen": {},
-            "LKW": {},
-            "Marken, Warenzeichen und Musterschutzrechte": {},
-            "Maschinenwerkzeuge": {},
-            "Nachrichten- und Kontrollanlagen": {},
-            "PKW": {},
-            "Pacht- und Mietrechte": {},
-            "Patentrechte und Lizenzen": {},
-            "Sonstige Ausleihungen": {},
-            "Sonstige Beteiligungen": {},
-            "Transportanlagen": {},
-            "Unbebaute Grundst\u00fccke": {},
-            "Vorrichtungen, Formen und Modelle": {},
-            "Wohn- und Sozialgeb\u00e4ude auf eigenem Grund": {},
-            "Wohn- und Sozialgeb\u00e4ude auf fremdem Grund": {},
+        },      
+        "Klasse 2 Aktiva: Umlaufverm\u00f6gen, Rechnungsabgrenzungen": {
+            "2030 Forderungen aus Lieferungen und Leistungen Inland (0% USt, umsatzsteuerfrei)": {
+                "account_type": "Receivable"
+            },
+            "2010 Forderungen aus Lieferungen und Leistungen Inland (10% USt, umsatzsteuerfrei)": {
+                "account_type": "Receivable"
+            },
+            "2000 Forderungen aus Lieferungen und Leistungen Inland (20% USt, umsatzsteuerfrei)": {
+                "account_type": "Receivable"
+            },
+            "2040 Forderungen aus Lieferungen und Leistungen Inland (sonstiger USt-Satz)": {
+                "account_type": "Receivable"
+            },                                    
+            "2100 Forderungen aus Lieferungen und Leistungen EU": {
+                "account_type": "Receivable"
+            },
+            "2150 Forderungen aus Lieferungen und Leistungen Ausland (Nicht-EU)": {
+                "account_type": "Receivable"
+            },
+            "2200 Forderungen gegen\u00fcber verbundenen Unternehmen": {
+                "account_type": "Receivable"
+            },
+            "2250 Forderungen gegen\u00fcber Unternehmen, mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
+                "account_type": "Receivable"
+            },
+            "2300 Sonstige Forderungen und Verm\u00f6gensgegenst\u00e4nde": {
+                "account_type": "Receivable"
+            },
+            "2630 Sonstige Wertpapiere": {
+                "account_type": "Stock"
+            },
+            "2750 Kassenbest\u00e4nde in Fremdw\u00e4hrung": {
+                "account_type": "Cash"
+            },
+            "2900 Aktive Rechnungsabrenzungsposten": {
+                "account_type": "Receivable"
+            },
+            "2600 Anteile an verbundenen Unternehmen": {
+                "account_type": "Equity"
+            },
+            "2680 Besitzwechsel ohne Forderungen": {
+                "account_type": "Receivable"
+            },
+            "2950 Aktiviertes Disagio": {
+                "account_type": "Receivable"
+            },
+            "2610 Eigene Anteile und Wertpapiere an mit Mehrheit beteiligten Unternehmen": {
+                "account_type": "Receivable"
+            },
+            "2570 Einfuhrumsatzsteuer (bezahlt)": {"account_type": "Tax"},
+            
+            "2460 Eingeforderte aber noch nicht eingezahlte Einlagen": {
+                "account_type": "Receivable"
+            },
+            "2180 Einzelwertberichtigungen zu Forderungen aus Lief. und Leist. Ausland": {
+                "account_type": "Receivable"
+            },
+            "2130 Einzelwertberichtigungen zu Forderungen aus Lief. und Leist. EU": {
+                "account_type": "Receivable"
+            },
+            "2080 Einzelwertberichtigungen zu Forderungen aus Lief. und Leist. Inland ": {
+                "account_type": "Receivable"
+            },
+            "2270 Einzelwertberichtigungen zu Forderungen gegen\u00fcber Unternehmen mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
+                "account_type": "Receivable"
+            },
+            "2230 Einzelwertberichtigungen zu Forderungen gegen\u00fcber verbundenen Unternehmen": {
+                "account_type": "Receivable"
+            },
+            "2470 Einzelwertberichtigungen zu sonstigen Forderungen und Verm\u00f6gensgegenst\u00e4nden": {
+                "account_type": "Receivable"
+            },
+            "2700 Kassenbestand": {
+                "account_type": "Cash"
+            },
+            "2190 Pauschalwertberichtigungen zu Forderungen aus Lief. und Leist. sonstiges Ausland": {
+                "account_type": "Receivable"
+            },
+            "2130 Pauschalwertberichtigungen zu Forderungen aus Lief. und Leist. EU": {
+                "account_type": "Receivable"
+            },
+            "2100 Pauschalwertberichtigungen zu Forderungen aus Lief. und Leist. Inland ": {
+                "account_type": "Receivable"
+            },
+            "2280 Pauschalwertberichtigungen zu Forderungen gegen\u00fcber Unternehmen mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
+                "account_type": "Receivable"
+            },
+            "2240 Pauschalwertberichtigungen zu Forderungen gegen\u00fcber verbundenen Unternehmen": {
+                "account_type": "Receivable"
+            },
+            "2480 Pauschalwertberichtigungen zu sonstigen Forderungen und Verm\u00f6gensgegenst\u00e4nden": {
+                "account_type": "Receivable"
+            },
+            "2740 Postwertzeichen": {
+                "account_type": "Cash"
+            },
+            "2780 Schecks in Euro": {
+                "account_type": "Cash"
+            },
+            "2800 Guthaben bei Bank": {
+                "account_type": "Bank"
+            },  
+            "2801 Guthaben bei Bank - Sparkonto": {
+                "account_type": "Bank"
+            },                      
+            "2810 Guthaben bei Paypal": {
+                "account_type": "Bank"
+            },
+            "2930 Mietvorauszahlungen": {
+                "account_type": "Receivable"
+            },
+            "2980 Abgrenzung latenter Steuern": {
+                "account_type": "Receivable"
+            },
+            "2500 Vorsteuer": {
+                "account_type": "Receivable"
+            },
+            "2510 Vorsteuer Inland 10%": {
+                "account_type": "Tax"
+            },
+            "2895 Schwebende Geldbewegugen": {
+                "account_type": "Bank"
+            },            
+            "2513 Vorsteuer Inland 5%": {
+                "account_type": "Tax"
+            },
+            "2515 Vorsteuer Inland 20%": {
+                "account_type": "Tax"
+            },                        
+            "2520 Vorsteuer aus innergemeinschaftlichem Erwerb 10%": {
+                "account_type": "Tax"
+            },
+            "2525 Vorsteuer aus innergemeinschaftlichem Erwerb 20%": {
+                "account_type": "Tax"
+            },            
+            "2530 Vorsteuer \u00a719/Art 19 ( reverse charge ) ": {
+                "account_type": "Tax"
+            },
+            "2690 Wertberichtigungen zu Wertpapieren und Anteilen": {
+                "account_type": "Receivable"
+            },
             "root_type": "Asset"
         },
-        "Summe Personalaufwand": {
-            "6000 bis 6190 L\u00f6hne": {},
-            "6200 bis 6390 Geh\u00e4lter": {},
-            "6400 bis 6440 Aufwendungen f\u00fcr Abfertigungen": {},
-            "6450 bis 6490 Aufwendungen f\u00fcr Altersversorgung": {},
-            "6500 bis 6550 Gesetzlicher Sozialaufwand Arbeiter": {},
-            "6560 bis 6590 Gesetzlicher Sozialaufwand Angestellte": {},
-            "6600 bis 6650 Lohnabh\u00e4ngige Abgaben und Pflichtbeitr\u00e4gte": {},
-            "6660 bis 6690 Gehaltsabh\u00e4ngige Abgaben und Pflichtbeitr\u00e4gte": {},
-            "6700 bis 6890 Sonstige Sozialaufwendungen": {},
-            "Aufwandsstellenrechnung": {},
+          "Klasse 4: Betriebliche Erträge": {
+            "4000 Erlöse 20 %": {"account_type": "Income Account"},          
+            "4020 Erl\u00f6se 0 % steuerbefreit": {"account_type": "Income Account"},            
+            "4010 Erl\u00f6se 10 %": {"account_type": "Income Account"},
+            "4030 Erl\u00f6se 13 %": {"account_type": "Income Account"},            
+            "4040 Erl\u00f6se 0 % innergemeinschaftliche Lieferungen": {"account_type": "Income Account"},      
+            "4400 Erl\u00f6sreduktion 0 % steuerbefreit": {"account_type": "Expense Account"},            
+            "4410 Erl\u00f6sreduktion 10 %": {"account_type": "Expense Account"},
+            "4420 Erl\u00f6sreduktion 20 %": {"account_type": "Expense Account"},
+            "4430 Erl\u00f6sreduktion 13 %": {"account_type": "Expense Account"},            
+            "4440 Erl\u00f6sreduktion 0 % innergemeinschaftliche Lieferungen": {"account_type": "Expense Account"}, 
+            "4500 Ver\u00e4nderungen des Bestandes an fertigen und unfertigen Erzeugn. sowie an noch nicht abrechenbaren Leistungen": {"account_type": "Income Account"},
+            "4580 Aktivierte Eigenleistungen": {"account_type": "Income Account"},
+            "4600 Erl\u00f6se aus dem Abgang vom Anlageverm\u00f6gen, ausgen. Finanzanlagen": {"account_type": "Income Account"},
+            "4630 Ertr\u00e4ge aus dem Abgang vom Anlageverm\u00f6gen, ausgen. Finanzanlagen": {"account_type": "Income Account"},
+            "4660 Ertr\u00e4ge aus der Zuschreibung zum Anlageverm\u00f6gen, ausgen. Finanzanlagen": {"account_type": "Income Account"},
+            "4700 Ertr\u00e4ge aus der Aufl\u00f6sung von R\u00fcckstellungen": {"account_type": "Income Account"},
+            "4800 \u00dcbrige betriebliche Ertr\u00e4ge": {"account_type": "Income Account"},
+            "root_type": "Income"
+        },        
+        "Klasse 5: Aufwand f\u00fcr Material und Leistungen": {
+            "5000 Einkauf Partnerleistungen": {"account_type": "Cost of Goods Sold"},        
+            "5100 Verbrauch an Rohstoffen": {"account_type": "Cost of Goods Sold"},
+            "5200 Verbrauch von bezogenen Fertig- und Einzelteilen": {"account_type": "Cost of Goods Sold"},
+            "5300 Verbrauch von Hilfsstoffen": {"account_type": "Cost of Goods Sold"},
+            "5340 Verbrauch Verpackungsmaterial": {"account_type": "Cost of Goods Sold"},
+            "5470 Verbrauch von Kleinmaterial": {"account_type": "Cost of Goods Sold"},
+            "5450 Verbrauch von Reinigungsmaterial": {"account_type": "Cost of Goods Sold"},                                  
+            "5400 Verbrauch von Betriebsstoffen": {"account_type": "Cost of Goods Sold"},
+            "5500 Verbrauch von Werkzeugen und anderen Erzeugungshilfsmittel": {"account_type": "Cost of Goods Sold"},
+            "5600 Verbrauch von Brenn- und Treibstoffen, Energie und Wasser": {"account_type": "Cost of Goods Sold"},
+            "5700 Bearbeitung durch Dritte": {"account_type": "Cost of Goods Sold"},
+            "5900 Aufwandsstellenrechnung Material": {"account_type": "Cost of Goods Sold"},
+            "5820 Skontoertr\u00e4ge (20% USt.)": {"account_type": "Income Account"},
+            "5810 Skontoertr\u00e4ge (10% USt.)": {"account_type": "Income Account"},
+            "5010 Handelswareneinkauf 10 %": {"account_type": "Cost of Goods Sold"},
+            "5020 Handelswareneinkauf 20 %": {"account_type": "Cost of Goods Sold"},
+            "5040 Handelswareneinkauf innergemeinschaftlicher Erwerb 10 % VSt/10 % USt": {"account_type": "Cost of Goods Sold"},
+            "5050 Handelswareneinkauf innergemeinschaftlicher Erwerb 20 % VSt/20 % USt": {"account_type": "Cost of Goods Sold"},
+            "5070 Handelswareneinkauf innergemeinschaftlicher Erwerb ohne Vorsteuerabzug und 10 % USt": {"account_type": "Cost of Goods Sold"},
+            "5080 Handelswareneinkauf innergemeinschaftlicher Erwerb ohne Vorsteuerabzug und 20 % USt": {"account_type": "Cost of Goods Sold"},
             "root_type": "Expense"
         },
-        "Summe Umlaufverm\u00f6gen": {
-            "2000 bis 2007 Forderungen aus Lief. und Leist. Inland": {
-                "account_type": "Receivable"
-            },
-            "2100 bis 2120 Forderungen aus Lief. und Leist. EU": {
-                "account_type": "Receivable"
-            },
-            "2150 bis 2170 Forderungen aus Lief. und Leist. Ausland": {
-                "account_type": "Receivable"
-            },
-            "2200 bis 2220 Forderungen gegen\u00fcber verbundenen Unternehmen": {
-                "account_type": "Receivable"
-            },
-            "2250 bis 2270 Forderungen gegen\u00fcber Unternehmen, mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
-                "account_type": "Receivable"
-            },
-            "2300 bis 2460 Sonstige Forderungen und Verm\u00f6gensgegenst\u00e4nde": {
-                "account_type": "Receivable"
-            },
-            "2630 bis 2670 Sonstige Wertpapiere": {
-                "account_type": "Receivable"
-            },
-            "2750 bis 2770 Kassenbest\u00e4nde in Fremdw\u00e4hrung": {
-                "account_type": "Receivable"
-            },
-            "Aktive Rechnungsabrenzungsposten": {
-                "account_type": "Receivable"
-            },
-            "Anteile an verbundenen Unternehmen": {
-                "account_type": "Receivable"
-            },
-            "Bank / Guthaben bei Kreditinstituten": {
-                "account_type": "Receivable"
-            },
-            "Besitzwechsel ...": {
-                "account_type": "Receivable"
-            },
-            "Disagio": {
-                "account_type": "Receivable"
-            },
-            "Eigene Anteile (Wertpapiere)": {
-                "account_type": "Receivable"
-            },
-            "Einfuhrumsatzsteuer (bezahlt)": {},
-            "Eingeforderte aber noch nicht eingezahlte Einlagen": {
-                "account_type": "Receivable"
-            },
-            "Einzelwertberichtigungen zu Forderungen aus Lief. und Leist. Ausland": {
-                "account_type": "Receivable"
-            },
-            "Einzelwertberichtigungen zu Forderungen aus Lief. und Leist. EU": {
-                "account_type": "Receivable"
-            },
-            "Einzelwertberichtigungen zu Forderungen aus Lief. und Leist. Inland ": {
-                "account_type": "Receivable"
-            },
-            "Einzelwertberichtigungen zu Forderungen gegen\u00fcber Unternehmen mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
-                "account_type": "Receivable"
-            },
-            "Einzelwertberichtigungen zu Forderungen gegen\u00fcber verbundenen Unternehmen": {
-                "account_type": "Receivable"
-            },
-            "Einzelwertberichtigungen zu sonstigen Forderungen und Verm\u00f6gensgegenst\u00e4nden": {
-                "account_type": "Receivable"
-            },
-            "Kassenbestand": {
-                "account_type": "Receivable"
-            },
-            "Pauschalwertberichtigungen zu Forderungen aus Lief. und Leist. Ausland": {
-                "account_type": "Receivable"
-            },
-            "Pauschalwertberichtigungen zu Forderungen aus Lief. und Leist. EU": {
-                "account_type": "Receivable"
-            },
-            "Pauschalwertberichtigungen zu Forderungen aus Lief. und Leist. Inland ": {
-                "account_type": "Receivable"
-            },
-            "Pauschalwertberichtigungen zu Forderungen gegen\u00fcber Unternehmen mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
-                "account_type": "Receivable"
-            },
-            "Pauschalwertberichtigungen zu Forderungen gegen\u00fcber verbundenen Unternehmen": {
-                "account_type": "Receivable"
-            },
-            "Pauschalwertberichtigungen zu sonstigen Forderungen und Verm\u00f6gensgegenst\u00e4nden": {
-                "account_type": "Receivable"
-            },
-            "Postwertzeichen": {
-                "account_type": "Receivable"
-            },
-            "Schecks in Inlandsw\u00e4hrung": {
-                "account_type": "Receivable"
-            },
-            "Sonstige Anteile": {
-                "account_type": "Receivable"
-            },
-            "Stempelmarken": {
-                "account_type": "Receivable"
-            },
-            "Steuerabgrenzung": {
-                "account_type": "Receivable"
-            },
-            "Unterschiedsbetrag gem. Abschnitt XII Pensionskassengesetz": {
-                "account_type": "Receivable"
-            },
-            "Unterschiedsbetrag zur gebotenen Pensionsr\u00fcckstellung": {
-                "account_type": "Receivable"
-            },
-            "Vorsteuer": {
-                "account_type": "Receivable"
-            },
-            "Vorsteuer aus ig. Erwerb 10%": {
-                "account_type": "Tax"
-            },
-            "Vorsteuer aus ig. Erwerb 20%": {
-                "account_type": "Tax"
-            },
-            "Vorsteuer \u00a719/Art 19 ( reverse charge ) ": {
-                "account_type": "Tax"
-            },
-            "Wertberichtigungen": {
-                "account_type": "Receivable"
-            },
-            "root_type": "Asset"
-        },
-        "Summe Vorr\u00e4te": {
-            "1000 bis 1090 Bezugsverrechnung": {},
-            "1100 bis 1190 Rohstoffe": {},
-            "1200 bis 1290 Bezogene Teile": {},
-            "1300 bis 1340 Hilfsstoffe": {},
-            "1350 bis 1390 Betriebsstoffe": {},
-            "1400 bis 1490 Unfertige Erzeugniss": {},
-            "1500 bis 1590 Fertige Erzeugniss": {},
-            "1600 bis 1690 Waren": {},
-            "1700 bis 1790 Noch nicht abgerechenbare Leistungen": {},
-            "1900 bis 1990 Wertberichtigungen": {},
-            "geleistete Anzahlungen": {},
-            "root_type": "Asset"
-        },
-        "Summe Wareneinsatz": {
-            "5100 bis 5190 Verbrauch an Rohstoffen": {},
-            "5200 bis 5290 Verbrauch von bezogenen Fertig- und Einzelteilen": {},
-            "5300 bis 5390 Verbrauch von Hilfsstoffen": {},
-            "5400 bis 5490 Verbrauch von Betriebsstoffen": {},
-            "5500 bis 5590 Verbrauch von Werkzeugen und anderen Erzeugungshilfsmittel": {},
-            "5600 bis 5690 Verbrauch von Brenn- und Treibstoffen, Energie und Wasser": {},
-            "5700 bis 5790 Sonstige bezogene Herstellungsleistungen": {},
-            "Aufwandsstellenrechnung": {},
-            "Skontoertr\u00e4ge auf Materialaufwand": {},
-            "Skontoertr\u00e4ge auf sonstige bezogene Herstellungsleistungen": {},
-            "Wareneinkauf 10 %": {},
-            "Wareneinkauf 20 %": {},
-            "Wareneinkauf igErwerb 10 % VSt/10 % USt": {},
-            "Wareneinkauf igErwerb 20 % VSt/20 % USt": {},
-            "Wareneinkauf igErwerb ohne Vorsteuerabzug und 10 % USt": {},
-            "Wareneinkauf igErwerb ohne Vorsteuerabzug und 20 % USt": {},
+        "Klasse 6: Personalaufwand": {
+            "6000 L\u00f6hne": {"account_type": "Payable"},
+            "6200 Geh\u00e4lter": {"account_type": "Payable"},
+            "6400 Aufwendungen f\u00fcr Abfertigungen": {"account_type": "Payable"},
+            "6450 Aufwendungen f\u00fcr Altersversorgung": {"account_type": "Payable"},
+            "6500 Gesetzlicher Sozialaufwand Arbeiter": {"account_type": "Payable"},
+            "6560 Gesetzlicher Sozialaufwand Angestellte": {"account_type": "Payable"},
+            "6600 Lohnabh\u00e4ngige Abgaben und Pflichtbeitr\u00e4gte": {"account_type": "Payable"},
+            "6660 Gehaltsabh\u00e4ngige Abgaben und Pflichtbeitr\u00e4gte": {"account_type": "Payable"},
+            "6700 Sonstige Sozialaufwendungen": {"account_type": "Payable"},
+            "6900 Aufwandsstellenrechnung Personal": {"account_type": "Payable"},
             "root_type": "Expense"
+        },       
+         "Klasse 7: Abschreibungen und sonstige betriebliche Aufwendungen": {
+            "7010 Abschreibungen auf das Anlageverm\u00f6gen (ausgenommen Finanzanlagen)": {"account_type": "Depreciation"},
+            "7100 Sonstige Steuern und Geb\u00fchren": {"account_type": "Tax"},
+            "7200 Instandhaltung u. Reinigung durch Dritte, Entsorgung, Energie": {"account_type": "Expense Account"},
+            "7300 Transporte durch Dritte": {"account_type": "Expense Account"},
+            "7310 Fahrrad - Aufwand": {"account_type": "Expense Account"},
+            "7320 Kfz - Aufwand": {"account_type": "Expense Account"},
+            "7330 LKW - Aufwand": {"account_type": "Expense Account"},
+            "7340 Lastenrad - Aufwand": {"account_type": "Expense Account"},            
+            "7350 Reise- und Fahraufwand": {"account_type": "Expense Account"},
+            "7360 Tag- und N\u00e4chtigungsgelder": {"account_type": "Expense Account"},
+            "7380 Nachrichtenaufwand": {"account_type": "Expense Account"},
+            "7400 Miet- und Pachtaufwand": {"account_type": "Expense Account"},
+            "7440 Leasingaufwand": {"account_type": "Expense Account"},
+            "7480 Lizenzaufwand": {"account_type": "Expense Account"},
+            "7500 Aufwand f\u00fcr beigestelltes Personal": {"account_type": "Expense Account"},
+            "7540 Provisionen an Dritte": {"account_type": "Expense Account"},
+            "7580 Aufsichtsratsverg\u00fctungen": {"account_type": "Expense Account"},
+            "7610 Druckerzeugnisse und Vervielf\u00e4ltigungen": {"account_type": "Expense Account"},
+            "7650 Werbung und Repr\u00e4sentationen": {"account_type": "Expense Account"},
+            "7700 Versicherungen": {"account_type": "Expense Account"},
+            "7750 Beratungs- und Pr\u00fcfungsaufwand": {"account_type": "Expense Account"},
+            "7800 Forderungsverluste und Schadensf\u00e4lle": {"account_type": "Expense Account"},
+            "7840 Verschiedene betriebliche Aufwendungen": {"account_type": "Expense Account"},
+            "7910 Aufwandsstellenrechung der Hersteller": {"account_type": "Expense Account"},
+            "7060 Sofortabschreibungen geringwertig": {"account_type": "Expense Account"},
+            "7070 Abschreibungen vom Umlaufverm\u00f6gen, soweit diese die im Unternehmen \u00fcblichen Abschreibungen \u00fcbersteigen": {"account_type": "Depreciation"},
+            "7900 Aufwandsstellenrechnung": {"account_type": "Expense Account"},
+            "7770 Aus- und Fortbildung": {"account_type": "Expense Account"},
+            "7820 Buchwert abgegangener Anlagen, ausgenommen Finanzanlagen": {"account_type": "Expense Account"},
+            "7600 B\u00fcromaterial und Drucksorten": {"account_type": "Expense Account"},
+            "7630 Fachliteratur und Zeitungen ": {"account_type": "Expense Account"},
+            "7960 Herstellungskosten der zur Erzielung der Umsatzerl\u00f6se erbrachten Leistungen": {"account_type": "Expense Account"},
+            "7780 Mitgliedsbeitr\u00e4ge": {"account_type": "Expense Account"},
+            "7880 Skontoertr\u00e4ge auf sonstige betriebliche Aufwendungen": {"account_type": "Expense Account"},
+            "7990 Sonstige betrieblichen Aufwendungen": {"account_type": "Expense Account"},
+            "7680 Spenden und Trinkgelder": {"account_type": "Expense Account"},
+            "7790 Spesen des Geldverkehrs": {"account_type": "Expense Account"},
+            "7830 Verluste aus dem Abgang vom Anlageverm\u00f6gen, ausgenommen Finanzanlagen": {"account_type": "Expense Account"},
+            "7970 Vertriebskosten": {"account_type": "Expense Account"},
+            "7980 Verwaltungskosten": {"account_type": "Expense Account"},
+            "root_type": "Expense"
+        },
+         "Klasse 8: Finanz- und ausserordentliche Ertr\u00e4ge und Aufwendungen": {
+            "8000 Ertr\u00e4ge aus Beteiligungen": {"account_type": "Income Account"},
+            "8050 Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": {"account_type": "Income Account"},
+            "8100 Zinsen aus Bankguthaben": {"account_type": "Income Account"},
+            "8110 Zinsen aus gewaehrten Darlehen": {"account_type": "Income Account"},
+            "8130 Verzugszinsenertraege": {"account_type": "Income Account"},
+            "8220 Aufwendungen aus Beteiligungen": {"account_type": "Expense Account"},
+            "8260 Aufwendungen aus sonst. Fiananzanlagen und aus Wertpapieren des Umlaufverm\u00f6gens": {},
+            "8280 Zinsen und \u00e4hnliche Aufwendungem": {"account_type": "Expense Account"},
+            "8400 Au\u00dferordentliche Ertr\u00e4ge": {"account_type": "Income Account"},
+            "8450 Au\u00dferordentliche Aufwendungen": {"account_type": "Expense Account"},
+            "8500 Steuern vom Einkommen und vom Ertrag": {
+                "account_type": "Tax"
+            },
+            "8600 Aufl\u00f6sung unversteuerten R\u00fccklagen": {"account_type": "Income Account"},
+            "8700 Aufl\u00f6sung von Kapitalr\u00fccklagen": {"account_type": "Income Account"},
+            "8750 Aufl\u00f6sung von Gewinnr\u00fccklagen": {"account_type": "Income Account"},
+            "8800 Zuweisung zu unversteuerten R\u00fccklagen": {"account_type": "Expense Account"},
+            "8900 Zuweisung zu Gewinnr\u00fccklagen": {"account_type": "Expense Account"},
+            "8100 Buchwert abgegangener Beteiligungen": {"account_type": "Expense Account"},
+            "8130 Buchwert abgegangener Wertpapiere des Umlaufverm\u00f6gens": {"account_type": "Expense Account"},
+            "8120 Buchwert abgegangener sonstiger Finanzanlagen": {"account_type": "Expense Account"},
+            "8990 Gewinnabfuhr bzw. Verlust\u00fcberrechnung aus Ergebnisabf\u00fchrungsvertr\u00e4gen": {"account_type": "Expense Account"},
+            "8350 nicht ausgenutzte Lieferantenskonti": {"account_type": "Expense Account"},
+            "root_type": "Income"
+        },       
+        "Klasse 9 Passiva: Eigenkapital, R\u00fccklagen, stille Einlagen, Abschlusskonten": {
+            "9000 Gezeichnetes bzw. gewidmetes Kapital": {
+                "account_type": "Equity"
+            },
+            "9200 Kapitalr\u00fccklagen": {
+                "account_type": "Equity"
+            },
+            "9300 Gewinnr\u00fccklagen": {
+                "account_type": "Equity"
+            },
+            "9400 Bewertungsreserven uns sonst. unversteuerte R\u00fccklagen": {
+                "account_type": "Equity"
+            },
+            "9600 Private Entnahmen": {"account_type": "Equity"},
+            "9610 Privatsteuern": {"account_type": "Equity"},
+            "9700 Einlagen stiller Gesellschafter ": {"account_type": "Equity"},
+            "9900 Evidenzkonto": {"account_type": "Equity"},
+            "9800 Er\u00f6ffnungsbilanzkonto (EBK)": {"account_type": "Equity"},
+            "9880 Jahresergebnis laut Gewinn- und Verlustrechnung (G+V)": {"account_type": "Equity"},
+            "9850 Schlussbilanzkonto (SBK)": {"account_type": "Round Off"},
+            "9190 nicht eingeforderte ausstehende Einlagen und berechtigte Entnahmen von Gesellschaftern": {
+                "account_type": "Equity"
+            },
+            "root_type": "Equity"
         }
-    }
-}
+     }   
+  }
diff --git a/erpnext/accounts/doctype/budget/budget.json b/erpnext/accounts/doctype/budget/budget.json
index fc4dd20..f0566f4 100644
--- a/erpnext/accounts/doctype/budget/budget.json
+++ b/erpnext/accounts/doctype/budget/budget.json
@@ -1,6 +1,7 @@
 {
  "actions": [],
  "allow_import": 1,
+ "autoname": "naming_series:",
  "creation": "2016-05-16 11:42:29.632528",
  "doctype": "DocType",
  "editable_grid": 1,
@@ -9,6 +10,7 @@
   "budget_against",
   "company",
   "cost_center",
+  "naming_series",
   "project",
   "fiscal_year",
   "column_break_3",
@@ -190,15 +192,26 @@
    "label": "Budget Accounts",
    "options": "Budget Account",
    "reqd": 1
+  },
+  {
+   "fieldname": "naming_series",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Series",
+   "no_copy": 1,
+   "print_hide": 1,
+   "read_only": 1,
+   "set_only_once": 1
   }
  ],
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2020-10-06 15:13:54.055854",
+ "modified": "2022-10-10 22:14:36.361509",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Budget",
+ "naming_rule": "By \"Naming Series\" field",
  "owner": "Administrator",
  "permissions": [
   {
@@ -220,5 +233,6 @@
  ],
  "sort_field": "modified",
  "sort_order": "DESC",
+ "states": [],
  "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
index 5527f9f..6ac3350 100644
--- a/erpnext/accounts/doctype/budget/budget.py
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -5,7 +5,6 @@
 import frappe
 from frappe import _
 from frappe.model.document import Document
-from frappe.model.naming import make_autoname
 from frappe.utils import add_months, flt, fmt_money, get_last_day, getdate
 
 from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
@@ -23,11 +22,6 @@
 
 
 class Budget(Document):
-	def autoname(self):
-		self.name = make_autoname(
-			self.get(frappe.scrub(self.budget_against)) + "/" + self.fiscal_year + "/.###"
-		)
-
 	def validate(self):
 		if not self.get(frappe.scrub(self.budget_against)):
 			frappe.throw(_("{0} is mandatory").format(self.budget_against))
@@ -109,6 +103,9 @@
 		):
 			self.applicable_on_booking_actual_expenses = 1
 
+	def before_naming(self):
+		self.naming_series = f"{{{frappe.scrub(self.budget_against)}}}./.{self.fiscal_year}/.###"
+
 
 def validate_expense_against_budget(args):
 	args = frappe._dict(args)
diff --git a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py
index a71b19e..fc6dbba 100644
--- a/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py
+++ b/erpnext/accounts/doctype/payment_ledger_entry/test_payment_ledger_entry.py
@@ -3,12 +3,13 @@
 
 import frappe
 from frappe import qb
-from frappe.tests.utils import FrappeTestCase
+from frappe.tests.utils import FrappeTestCase, change_settings
 from frappe.utils import nowdate
 
 from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
 from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry
 from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
 from erpnext.stock.doctype.item.test_item import create_item
 
 
@@ -127,6 +128,25 @@
 		payment.posting_date = posting_date
 		return payment
 
+	def create_sales_order(
+		self, qty=1, rate=100, posting_date=nowdate(), do_not_save=False, do_not_submit=False
+	):
+		so = make_sales_order(
+			company=self.company,
+			transaction_date=posting_date,
+			customer=self.customer,
+			item_code=self.item,
+			cost_center=self.cost_center,
+			warehouse=self.warehouse,
+			debit_to=self.debit_to,
+			currency="INR",
+			qty=qty,
+			rate=100,
+			do_not_save=do_not_save,
+			do_not_submit=do_not_submit,
+		)
+		return so
+
 	def clear_old_entries(self):
 		doctype_list = [
 			"GL Entry",
@@ -406,3 +426,89 @@
 		]
 		self.assertEqual(pl_entries_for_crnote[0], expected_values[0])
 		self.assertEqual(pl_entries_for_crnote[1], expected_values[1])
+
+	@change_settings(
+		"Accounts Settings",
+		{"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1},
+	)
+	def test_multi_payment_unlink_on_invoice_cancellation(self):
+		transaction_date = nowdate()
+		amount = 100
+		si = self.create_sales_invoice(qty=1, rate=amount, posting_date=transaction_date)
+
+		for amt in [40, 40, 20]:
+			# payment 1
+			pe = get_payment_entry(si.doctype, si.name)
+			pe.paid_amount = amt
+			pe.get("references")[0].allocated_amount = amt
+			pe = pe.save().submit()
+
+		si.reload()
+		si.cancel()
+
+		entries = frappe.db.get_list(
+			"Payment Ledger Entry",
+			filters={"against_voucher_type": si.doctype, "against_voucher_no": si.name, "delinked": 0},
+		)
+		self.assertEqual(entries, [])
+
+		# with references removed, deletion should be possible
+		si.delete()
+		self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name)
+
+	@change_settings(
+		"Accounts Settings",
+		{"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1},
+	)
+	def test_multi_je_unlink_on_invoice_cancellation(self):
+		transaction_date = nowdate()
+		amount = 100
+		si = self.create_sales_invoice(qty=1, rate=amount, posting_date=transaction_date)
+
+		# multiple JE's against invoice
+		for amt in [40, 40, 20]:
+			je1 = self.create_journal_entry(
+				self.income_account, self.debit_to, amt, posting_date=transaction_date
+			)
+			je1.get("accounts")[1].party_type = "Customer"
+			je1.get("accounts")[1].party = self.customer
+			je1.get("accounts")[1].reference_type = si.doctype
+			je1.get("accounts")[1].reference_name = si.name
+			je1 = je1.save().submit()
+
+		si.reload()
+		si.cancel()
+
+		entries = frappe.db.get_list(
+			"Payment Ledger Entry",
+			filters={"against_voucher_type": si.doctype, "against_voucher_no": si.name, "delinked": 0},
+		)
+		self.assertEqual(entries, [])
+
+		# with references removed, deletion should be possible
+		si.delete()
+		self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name)
+
+	@change_settings(
+		"Accounts Settings",
+		{"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1},
+	)
+	def test_advance_payment_unlink_on_order_cancellation(self):
+		transaction_date = nowdate()
+		amount = 100
+		so = self.create_sales_order(qty=1, rate=amount, posting_date=transaction_date).save().submit()
+
+		pe = get_payment_entry(so.doctype, so.name).save().submit()
+
+		so.reload()
+		so.cancel()
+
+		entries = frappe.db.get_list(
+			"Payment Ledger Entry",
+			filters={"against_voucher_type": so.doctype, "against_voucher_no": so.name, "delinked": 0},
+		)
+		self.assertEqual(entries, [])
+
+		# with references removed, deletion should be possible
+		so.delete()
+		self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, so.doctype, so.name)
diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
index 70f128e..3132fdd 100644
--- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
@@ -495,6 +495,67 @@
 
 		self.assertRaises(frappe.ValidationError, pos.submit)
 
+	def test_value_error_on_serial_no_validation(self):
+		from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
+
+		se = make_serialized_item(
+			company="_Test Company",
+			target_warehouse="Stores - _TC",
+			cost_center="Main - _TC",
+			expense_account="Cost of Goods Sold - _TC",
+		)
+		serial_nos = se.get("items")[0].serial_no
+
+		# make a pos invoice
+		pos = create_pos_invoice(
+			company="_Test Company",
+			debit_to="Debtors - _TC",
+			account_for_change_amount="Cash - _TC",
+			warehouse="Stores - _TC",
+			income_account="Sales - _TC",
+			expense_account="Cost of Goods Sold - _TC",
+			cost_center="Main - _TC",
+			item=se.get("items")[0].item_code,
+			rate=1000,
+			qty=1,
+			do_not_save=1,
+		)
+		pos.get("items")[0].has_serial_no = 1
+		pos.get("items")[0].serial_no = serial_nos.split("\n")[0]
+		pos.set("payments", [])
+		pos.append(
+			"payments", {"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 1000, "default": 1}
+		)
+		pos = pos.save().submit()
+
+		# make a return
+		pos_return = make_sales_return(pos.name)
+		pos_return.paid_amount = pos_return.grand_total
+		pos_return.save()
+		pos_return.submit()
+
+		# set docstatus to 2 for pos to trigger this issue
+		frappe.db.set_value("POS Invoice", pos.name, "docstatus", 2)
+
+		pos2 = create_pos_invoice(
+			company="_Test Company",
+			debit_to="Debtors - _TC",
+			account_for_change_amount="Cash - _TC",
+			warehouse="Stores - _TC",
+			income_account="Sales - _TC",
+			expense_account="Cost of Goods Sold - _TC",
+			cost_center="Main - _TC",
+			item=se.get("items")[0].item_code,
+			rate=1000,
+			qty=1,
+			do_not_save=1,
+		)
+
+		pos2.get("items")[0].has_serial_no = 1
+		pos2.get("items")[0].serial_no = serial_nos.split("\n")[0]
+		# Value error should not be triggered on validation
+		pos2.save()
+
 	def test_loyalty_points(self):
 		from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
 			get_loyalty_program_details_with_points,
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 3020e6d..e73d602 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -12,39 +12,23 @@
   "supplier",
   "supplier_name",
   "tax_id",
-  "due_date",
-  "tax_withholding_category",
-  "column_break1",
   "company",
+  "column_break_6",
   "posting_date",
   "posting_time",
   "set_posting_time",
+  "due_date",
+  "column_break1",
   "is_paid",
   "is_return",
+  "return_against",
   "apply_tds",
+  "tax_withholding_category",
   "amended_from",
   "accounting_dimensions_section",
   "cost_center",
   "dimension_col_break",
   "project",
-  "supplier_invoice_details",
-  "bill_no",
-  "column_break_15",
-  "bill_date",
-  "returns",
-  "return_against",
-  "section_addresses",
-  "supplier_address",
-  "address_display",
-  "contact_person",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
-  "col_break_address",
-  "shipping_address",
-  "shipping_address_display",
-  "billing_address",
-  "billing_address_display",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -54,39 +38,33 @@
   "plc_conversion_rate",
   "ignore_pricing_rule",
   "sec_warehouse",
-  "set_warehouse",
-  "rejected_warehouse",
-  "col_break_warehouse",
-  "set_from_warehouse",
-  "supplier_warehouse",
-  "is_subcontracted",
-  "items_section",
-  "update_stock",
   "scan_barcode",
+  "col_break_warehouse",
+  "update_stock",
+  "set_warehouse",
+  "set_from_warehouse",
+  "is_subcontracted",
+  "rejected_warehouse",
+  "supplier_warehouse",
+  "items_section",
   "items",
-  "pricing_rule_details",
-  "pricing_rules",
-  "raw_materials_supplied",
-  "supplied_items",
   "section_break_26",
   "total_qty",
+  "total_net_weight",
+  "column_break_50",
   "base_total",
   "base_net_total",
   "column_break_28",
-  "total_net_weight",
   "total",
   "net_total",
   "taxes_section",
+  "taxes_and_charges",
+  "column_break_58",
   "tax_category",
   "column_break_49",
   "shipping_rule",
   "section_break_51",
-  "taxes_and_charges",
   "taxes",
-  "tax_withheld_vouchers_section",
-  "tax_withheld_vouchers",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "totals",
   "base_taxes_and_charges_added",
   "base_taxes_and_charges_deducted",
@@ -95,12 +73,6 @@
   "taxes_and_charges_added",
   "taxes_and_charges_deducted",
   "total_taxes_and_charges",
-  "section_break_44",
-  "apply_discount_on",
-  "base_discount_amount",
-  "column_break_46",
-  "additional_discount_percentage",
-  "discount_amount",
   "section_break_49",
   "base_grand_total",
   "base_rounding_adjustment",
@@ -114,24 +86,58 @@
   "total_advance",
   "outstanding_amount",
   "disable_rounded_total",
+  "section_break_44",
+  "apply_discount_on",
+  "base_discount_amount",
+  "additional_discount_account",
+  "column_break_46",
+  "additional_discount_percentage",
+  "discount_amount",
+  "tax_withheld_vouchers_section",
+  "tax_withheld_vouchers",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "pricing_rule_details",
+  "pricing_rules",
+  "raw_materials_supplied",
+  "supplied_items",
+  "payments_tab",
   "payments_section",
   "mode_of_payment",
-  "cash_bank_account",
+  "base_paid_amount",
   "clearance_date",
   "col_br_payments",
+  "cash_bank_account",
   "paid_amount",
-  "base_paid_amount",
+  "advances_section",
+  "allocate_advances_automatically",
+  "get_advances",
+  "advances",
+  "advance_tax",
   "write_off",
   "write_off_amount",
   "base_write_off_amount",
   "column_break_61",
   "write_off_account",
   "write_off_cost_center",
-  "advances_section",
-  "allocate_advances_automatically",
-  "get_advances",
-  "advances",
-  "advance_tax",
+  "address_and_contact_tab",
+  "section_addresses",
+  "supplier_address",
+  "address_display",
+  "col_break_address",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "company_shipping_address_section",
+  "shipping_address",
+  "column_break_126",
+  "shipping_address_display",
+  "company_billing_address_section",
+  "billing_address",
+  "column_break_130",
+  "billing_address_display",
+  "terms_tab",
   "payment_schedule_section",
   "payment_terms_template",
   "ignore_default_payment_terms_template",
@@ -139,23 +145,15 @@
   "terms_section_break",
   "tc_name",
   "terms",
-  "printing_settings",
-  "letter_head",
-  "select_print_heading",
-  "column_break_112",
-  "group_same_items",
-  "language",
-  "sb_14",
-  "on_hold",
-  "release_date",
-  "cb_17",
-  "hold_comment",
-  "more_info",
+  "more_info_tab",
+  "status_section",
   "status",
-  "inter_company_invoice_reference",
-  "represents_company",
-  "column_break_147",
-  "is_internal_supplier",
+  "column_break_177",
+  "per_received",
+  "supplier_invoice_details",
+  "bill_no",
+  "column_break_15",
+  "bill_date",
   "accounting_details_section",
   "credit_to",
   "party_account_currency",
@@ -163,15 +161,32 @@
   "against_expense_account",
   "column_break_63",
   "unrealized_profit_loss_account",
-  "remarks",
   "subscription_section",
-  "from_date",
-  "to_date",
-  "column_break_114",
   "auto_repeat",
   "update_auto_repeat_reference",
-  "per_received",
-  "is_old_subcontracting_flow"
+  "column_break_114",
+  "from_date",
+  "to_date",
+  "printing_settings",
+  "letter_head",
+  "group_same_items",
+  "column_break_112",
+  "select_print_heading",
+  "language",
+  "sb_14",
+  "on_hold",
+  "release_date",
+  "cb_17",
+  "hold_comment",
+  "additional_info_section",
+  "is_internal_supplier",
+  "represents_company",
+  "column_break_147",
+  "inter_company_invoice_reference",
+  "is_old_subcontracting_flow",
+  "remarks",
+  "connections_tab",
+  "column_break_38"
  ],
  "fields": [
   {
@@ -354,7 +369,7 @@
    "collapsible_depends_on": "bill_no",
    "fieldname": "supplier_invoice_details",
    "fieldtype": "Section Break",
-   "label": "Supplier Invoice Details"
+   "label": "Supplier Invoice"
   },
   {
    "fieldname": "bill_no",
@@ -379,12 +394,6 @@
   },
   {
    "depends_on": "return_against",
-   "fieldname": "returns",
-   "fieldtype": "Section Break",
-   "label": "Returns"
-  },
-  {
-   "depends_on": "return_against",
    "fieldname": "return_against",
    "fieldtype": "Link",
    "label": "Return Against Purchase Invoice",
@@ -394,10 +403,9 @@
    "read_only": 1
   },
   {
-   "collapsible": 1,
    "fieldname": "section_addresses",
    "fieldtype": "Section Break",
-   "label": "Address and Contact"
+   "label": "Supplier Address"
   },
   {
    "fieldname": "supplier_address",
@@ -518,11 +526,12 @@
   },
   {
    "fieldname": "sec_warehouse",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Items"
   },
   {
    "depends_on": "update_stock",
-   "description": "Sets 'Accepted Warehouse' in each row of the items table.",
    "fieldname": "set_warehouse",
    "fieldtype": "Link",
    "label": "Set Accepted Warehouse",
@@ -531,7 +540,6 @@
   },
   {
    "depends_on": "update_stock",
-   "description": "Warehouse where you are maintaining stock of rejected items",
    "fieldname": "rejected_warehouse",
    "fieldtype": "Link",
    "label": "Rejected Warehouse",
@@ -554,6 +562,7 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "oldfieldtype": "Section Break",
    "options": "fa fa-shopping-cart"
   },
@@ -581,6 +590,7 @@
    "reqd": 1
   },
   {
+   "collapsible": 1,
    "fieldname": "pricing_rule_details",
    "fieldtype": "Section Break",
    "label": "Pricing Rules"
@@ -593,6 +603,7 @@
    "read_only": 1
   },
   {
+   "collapsible": 1,
    "collapsible_depends_on": "supplied_items",
    "fieldname": "raw_materials_supplied",
    "fieldtype": "Section Break",
@@ -656,6 +667,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "label": "Total Net Weight",
@@ -665,6 +677,8 @@
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
   },
@@ -688,7 +702,8 @@
   },
   {
    "fieldname": "section_break_51",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1
   },
   {
    "fieldname": "taxes_and_charges",
@@ -792,7 +807,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_44",
    "fieldtype": "Section Break",
    "label": "Additional Discount"
@@ -832,7 +846,8 @@
   },
   {
    "fieldname": "section_break_49",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "label": "Totals"
   },
   {
    "fieldname": "base_grand_total",
@@ -1003,8 +1018,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "write_off_amount",
-   "depends_on": "grand_total",
    "fieldname": "write_off",
    "fieldtype": "Section Break",
    "label": "Write Off"
@@ -1081,7 +1094,6 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
    "collapsible_depends_on": "eval:(!doc.is_return)",
    "fieldname": "payment_schedule_section",
    "fieldtype": "Section Break",
@@ -1102,8 +1114,6 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "terms",
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
    "label": "Terms and Conditions",
@@ -1119,13 +1129,13 @@
   {
    "fieldname": "terms",
    "fieldtype": "Text Editor",
-   "label": "Terms and Conditions1"
+   "label": "Terms and Conditions"
   },
   {
    "collapsible": 1,
    "fieldname": "printing_settings",
    "fieldtype": "Section Break",
-   "label": "Printing Settings"
+   "label": "Print Settings"
   },
   {
    "allow_on_submit": 1,
@@ -1167,15 +1177,6 @@
    "read_only": 1
   },
   {
-   "collapsible": 1,
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Information",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-file-text",
-   "print_hide": 1
-  },
-  {
    "default": "0",
    "fetch_from": "supplier.is_internal_supplier",
    "fieldname": "is_internal_supplier",
@@ -1260,7 +1261,7 @@
    "collapsible": 1,
    "fieldname": "subscription_section",
    "fieldtype": "Section Break",
-   "label": "Subscription Section",
+   "label": "Subscription",
    "print_hide": 1
   },
   {
@@ -1339,7 +1340,7 @@
   },
   {
    "depends_on": "eval:doc.is_internal_supplier",
-   "description": "Unrealized Profit / Loss account for intra-company transfers",
+   "description": "Unrealized Profit/Loss account for intra-company transfers",
    "fieldname": "unrealized_profit_loss_account",
    "fieldtype": "Link",
    "label": "Unrealized Profit / Loss Account",
@@ -1356,7 +1357,6 @@
   },
   {
    "depends_on": "eval:doc.update_stock && doc.is_internal_supplier",
-   "description": "Sets 'From Warehouse' in each row of the items table.",
    "fieldname": "set_from_warehouse",
    "fieldtype": "Link",
    "label": "Set From Warehouse",
@@ -1422,6 +1422,7 @@
    "read_only": 1
   },
   {
+   "collapsible_depends_on": "tax_withheld_vouchers",
    "fieldname": "tax_withheld_vouchers_section",
    "fieldtype": "Section Break",
    "label": "Tax Withheld Vouchers"
@@ -1430,15 +1431,95 @@
    "fieldname": "tax_withheld_vouchers",
    "fieldtype": "Table",
    "label": "Tax Withheld Vouchers",
+   "no_copy": 1,
    "options": "Tax Withheld Vouchers",
    "read_only": 1
+  },
+  {
+   "fieldname": "payments_tab",
+   "fieldtype": "Tab Break",
+   "label": "Payments"
+  },
+  {
+   "fieldname": "address_and_contact_tab",
+   "fieldtype": "Tab Break",
+   "label": "Address & Contact"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_6",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_38",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_50",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_58",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "company_shipping_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Shipping Address"
+  },
+  {
+   "fieldname": "column_break_126",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "company_billing_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Billing Address"
+  },
+  {
+   "fieldname": "column_break_130",
+   "fieldtype": "Column Break"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "status_section",
+   "fieldtype": "Section Break",
+   "label": "Status"
+  },
+  {
+   "fieldname": "column_break_177",
+   "fieldtype": "Column Break"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "additional_info_section",
+   "fieldtype": "Section Break",
+   "label": "Additional Info",
+   "oldfieldtype": "Section Break",
+   "options": "fa fa-file-text",
+   "print_hide": 1
   }
  ],
  "icon": "fa fa-file-text",
  "idx": 204,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-09-27 11:07:55.766844",
+ "modified": "2022-10-11 13:04:44.304389",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 2da5157..97e5f40 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -12,44 +12,29 @@
   "customer",
   "customer_name",
   "tax_id",
-  "pos_profile",
-  "is_pos",
-  "is_consolidated",
-  "is_return",
-  "is_debit_note",
-  "update_billed_amount_in_sales_order",
-  "column_break1",
   "company",
   "company_tax_id",
+  "column_break1",
   "posting_date",
   "posting_time",
   "set_posting_time",
   "due_date",
+  "column_break_14",
+  "is_pos",
+  "pos_profile",
+  "is_consolidated",
+  "is_return",
   "return_against",
+  "update_billed_amount_in_sales_order",
+  "is_debit_note",
   "amended_from",
   "accounting_dimensions_section",
-  "project",
-  "dimension_col_break",
   "cost_center",
-  "customer_po_details",
-  "po_no",
-  "column_break_23",
-  "po_date",
-  "address_and_contact",
-  "customer_address",
-  "address_display",
-  "contact_person",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
-  "territory",
-  "col_break4",
-  "shipping_address_name",
-  "shipping_address",
-  "company_address",
-  "company_address_display",
-  "dispatch_address_name",
-  "dispatch_address",
+  "dimension_col_break",
+  "project",
+  "column_break_27",
+  "campaign",
+  "source",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -58,60 +43,35 @@
   "price_list_currency",
   "plc_conversion_rate",
   "ignore_pricing_rule",
-  "sec_warehouse",
-  "set_warehouse",
-  "column_break_55",
-  "set_target_warehouse",
   "items_section",
-  "update_stock",
   "scan_barcode",
+  "update_stock",
+  "column_break_39",
+  "set_warehouse",
+  "set_target_warehouse",
+  "section_break_42",
   "items",
-  "pricing_rule_details",
-  "pricing_rules",
-  "packing_list",
-  "packed_items",
-  "product_bundle_help",
-  "time_sheet_list",
-  "timesheets",
-  "total_billing_amount",
-  "total_billing_hours",
   "section_break_30",
   "total_qty",
+  "total_net_weight",
+  "column_break_32",
   "base_total",
   "base_net_total",
-  "column_break_32",
-  "total_net_weight",
+  "column_break_52",
   "total",
   "net_total",
   "taxes_section",
   "taxes_and_charges",
   "column_break_38",
   "shipping_rule",
+  "column_break_55",
   "tax_category",
   "section_break_40",
   "taxes",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "section_break_43",
   "base_total_taxes_and_charges",
   "column_break_47",
   "total_taxes_and_charges",
-  "loyalty_points_redemption",
-  "loyalty_points",
-  "loyalty_amount",
-  "redeem_loyalty_points",
-  "column_break_77",
-  "loyalty_program",
-  "loyalty_redemption_account",
-  "loyalty_redemption_cost_center",
-  "section_break_49",
-  "apply_discount_on",
-  "is_cash_or_non_trade_discount",
-  "base_discount_amount",
-  "additional_discount_account",
-  "column_break_51",
-  "additional_discount_percentage",
-  "discount_amount",
   "totals",
   "base_grand_total",
   "base_rounding_adjustment",
@@ -125,21 +85,28 @@
   "total_advance",
   "outstanding_amount",
   "disable_rounded_total",
-  "column_break4",
-  "write_off_amount",
-  "base_write_off_amount",
-  "write_off_outstanding_amount_automatically",
-  "column_break_74",
-  "write_off_account",
-  "write_off_cost_center",
-  "advances_section",
-  "allocate_advances_automatically",
-  "get_advances",
-  "advances",
-  "payment_schedule_section",
-  "ignore_default_payment_terms_template",
-  "payment_terms_template",
-  "payment_schedule",
+  "section_break_49",
+  "apply_discount_on",
+  "base_discount_amount",
+  "is_cash_or_non_trade_discount",
+  "additional_discount_account",
+  "column_break_51",
+  "additional_discount_percentage",
+  "discount_amount",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "pricing_rule_details",
+  "pricing_rules",
+  "packing_list",
+  "packed_items",
+  "product_bundle_help",
+  "time_sheet_list",
+  "timesheets",
+  "section_break_104",
+  "total_billing_hours",
+  "column_break_106",
+  "total_billing_amount",
+  "payments_tab",
   "payments_section",
   "cash_bank_account",
   "payments",
@@ -152,47 +119,95 @@
   "column_break_90",
   "change_amount",
   "account_for_change_amount",
+  "advances_section",
+  "allocate_advances_automatically",
+  "get_advances",
+  "advances",
+  "write_off_section",
+  "write_off_amount",
+  "base_write_off_amount",
+  "write_off_outstanding_amount_automatically",
+  "column_break_74",
+  "write_off_account",
+  "write_off_cost_center",
+  "loyalty_points_redemption",
+  "redeem_loyalty_points",
+  "loyalty_points",
+  "loyalty_amount",
+  "column_break_77",
+  "loyalty_program",
+  "loyalty_redemption_account",
+  "loyalty_redemption_cost_center",
+  "contact_and_address_tab",
+  "address_and_contact",
+  "customer_address",
+  "address_display",
+  "col_break4",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "territory",
+  "shipping_address_section",
+  "shipping_address_name",
+  "shipping_address",
+  "shipping_addr_col_break",
+  "dispatch_address_name",
+  "dispatch_address",
+  "company_address_section",
+  "company_address",
+  "company_addr_col_break",
+  "company_address_display",
+  "terms_tab",
+  "payment_schedule_section",
+  "ignore_default_payment_terms_template",
+  "payment_terms_template",
+  "payment_schedule",
   "terms_section_break",
   "tc_name",
   "terms",
-  "edit_printing_settings",
-  "letter_head",
-  "group_same_items",
-  "select_print_heading",
-  "column_break_84",
-  "language",
-  "more_information",
-  "status",
-  "inter_company_invoice_reference",
-  "represents_company",
-  "customer_group",
-  "campaign",
-  "col_break23",
-  "is_internal_customer",
-  "is_discounted",
-  "source",
+  "more_info_tab",
+  "customer_po_details",
+  "po_no",
+  "column_break_23",
+  "po_date",
   "more_info",
   "debit_to",
   "party_account_currency",
   "is_opening",
   "column_break8",
   "unrealized_profit_loss_account",
-  "remarks",
+  "against_income_account",
   "sales_team_section_break",
   "sales_partner",
-  "column_break10",
   "amount_eligible_for_commission",
+  "column_break10",
   "commission_rate",
   "total_commission",
   "section_break2",
   "sales_team",
+  "edit_printing_settings",
+  "letter_head",
+  "group_same_items",
+  "column_break_84",
+  "select_print_heading",
+  "language",
   "subscription_section",
   "from_date",
-  "to_date",
-  "column_break_140",
   "auto_repeat",
+  "column_break_140",
+  "to_date",
   "update_auto_repeat_reference",
-  "against_income_account"
+  "more_information",
+  "status",
+  "inter_company_invoice_reference",
+  "represents_company",
+  "customer_group",
+  "col_break23",
+  "is_internal_customer",
+  "is_discounted",
+  "remarks",
+  "connections_tab"
  ],
  "fields": [
   {
@@ -453,12 +468,11 @@
    "label": "Customer's Purchase Order Date"
   },
   {
-   "collapsible": 1,
    "fieldname": "address_and_contact",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Address and Contact"
+   "label": "Billing Address"
   },
   {
    "fieldname": "customer_address",
@@ -560,7 +574,6 @@
   {
    "fieldname": "company_address_display",
    "fieldtype": "Small Text",
-   "hidden": 1,
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Company Address",
@@ -652,13 +665,6 @@
    "print_hide": 1
   },
   {
-   "fieldname": "sec_warehouse",
-   "fieldtype": "Section Break",
-   "hide_days": 1,
-   "hide_seconds": 1,
-   "label": "Warehouse"
-  },
-  {
    "depends_on": "update_stock",
    "fieldname": "set_warehouse",
    "fieldtype": "Link",
@@ -671,6 +677,7 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Items",
@@ -702,7 +709,6 @@
    "fieldtype": "Table",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Items",
    "oldfieldname": "entries",
    "oldfieldtype": "Table",
    "options": "Sales Invoice Item",
@@ -755,9 +761,10 @@
   {
    "collapsible": 1,
    "collapsible_depends_on": "eval:doc.total_billing_amount > 0",
-   "depends_on": "eval: !doc.is_return",
+   "depends_on": "eval:!doc.is_return",
    "fieldname": "time_sheet_list",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Time Sheet List"
@@ -845,6 +852,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "hide_days": 1,
@@ -856,8 +864,10 @@
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
    "hide_seconds": 1,
+   "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
   },
@@ -900,6 +910,7 @@
   {
    "fieldname": "section_break_40",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
    "hide_seconds": 1
   },
@@ -908,7 +919,6 @@
    "fieldtype": "Table",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Sales Taxes and Charges",
    "oldfieldname": "other_charges",
    "oldfieldtype": "Table",
    "options": "Sales Taxes and Charges"
@@ -1046,7 +1056,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_49",
    "fieldtype": "Section Break",
    "hide_days": 1,
@@ -1102,6 +1111,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
+   "label": "Totals",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
    "print_hide": 1
@@ -1283,8 +1293,6 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "eval:(!doc.is_pos && !doc.is_return)",
    "fieldname": "payment_schedule_section",
    "fieldtype": "Section Break",
    "hide_days": 1,
@@ -1314,7 +1322,9 @@
    "print_hide": 1
   },
   {
-   "depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
+   "collapsible": 1,
+   "collapsible_depends_on": "eval:!doc.is_pos",
+   "depends_on": "eval:doc.is_pos===1",
    "fieldname": "payments_section",
    "fieldtype": "Section Break",
    "hide_days": 1,
@@ -1352,6 +1362,7 @@
    "hide_seconds": 1
   },
   {
+   "depends_on": "eval: doc.is_pos || doc.redeem_loyalty_points",
    "fieldname": "base_paid_amount",
    "fieldtype": "Currency",
    "hide_days": 1,
@@ -1383,10 +1394,13 @@
    "read_only": 1
   },
   {
+   "collapsible": 1,
+   "depends_on": "is_pos",
    "fieldname": "section_break_88",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "label": "Changes"
   },
   {
    "depends_on": "is_pos",
@@ -1428,17 +1442,6 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "write_off_amount",
-   "depends_on": "grand_total",
-   "fieldname": "column_break4",
-   "fieldtype": "Section Break",
-   "hide_days": 1,
-   "hide_seconds": 1,
-   "label": "Write Off",
-   "width": "50%"
-  },
-  {
    "fieldname": "write_off_amount",
    "fieldtype": "Currency",
    "hide_days": 1,
@@ -1495,8 +1498,6 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "terms",
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
    "hide_days": 1,
@@ -1530,7 +1531,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Printing Settings"
+   "label": "Print Settings"
   },
   {
    "allow_on_submit": 1,
@@ -1591,7 +1592,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "More Information"
+   "label": "Additional Info"
   },
   {
    "fieldname": "inter_company_invoice_reference",
@@ -1814,7 +1815,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Subscription Section"
+   "label": "Subscription"
   },
   {
    "allow_on_submit": 1,
@@ -1936,10 +1937,6 @@
    "read_only": 1
   },
   {
-   "fieldname": "column_break_55",
-   "fieldtype": "Column Break"
-  },
-  {
    "depends_on": "eval: doc.is_internal_customer && doc.update_stock",
    "fieldname": "set_target_warehouse",
    "fieldtype": "Link",
@@ -2009,6 +2006,97 @@
    "fieldname": "is_cash_or_non_trade_discount",
    "fieldtype": "Check",
    "label": "Is Cash or Non Trade Discount"
+  },
+  {
+   "fieldname": "contact_and_address_tab",
+   "fieldtype": "Tab Break",
+   "label": "Contact & Address"
+  },
+  {
+   "fieldname": "payments_tab",
+   "fieldtype": "Tab Break",
+   "label": "Payments"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_14",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_39",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "section_break_42",
+   "fieldtype": "Section Break",
+   "hide_border": 1,
+   "hide_days": 1,
+   "hide_seconds": 1
+  },
+  {
+   "fieldname": "column_break_55",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "shipping_address_section",
+   "fieldtype": "Section Break",
+   "label": "Shipping Address"
+  },
+  {
+   "fieldname": "company_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Address"
+  },
+  {
+   "fieldname": "shipping_addr_col_break",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "company_addr_col_break",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_27",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_52",
+   "fieldtype": "Column Break"
+  },
+  {
+   "depends_on": "eval:(!doc.is_return && doc.total_billing_amount > 0)",
+   "fieldname": "section_break_104",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "column_break_106",
+   "fieldtype": "Column Break"
+  },
+  {
+   "collapsible": 1,
+   "collapsible_depends_on": "write_off_amount",
+   "depends_on": "grand_total",
+   "fieldname": "write_off_section",
+   "fieldtype": "Section Break",
+   "hide_days": 1,
+   "hide_seconds": 1,
+   "label": "Write Off",
+   "width": "50%"
   }
  ],
  "icon": "fa fa-file-text",
@@ -2021,7 +2109,7 @@
    "link_fieldname": "consolidated_invoice"
   }
  ],
- "modified": "2022-09-16 17:44:22.227332",
+ "modified": "2022-10-11 13:07:36.488095",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 84c2c9a..7eddd81 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -249,6 +249,9 @@
 				)
 			else:
 				tax_amount = net_total * tax_details.rate / 100 if net_total > 0 else 0
+
+			# once tds is deducted, not need to add vouchers in the invoice
+			voucher_wise_amount = {}
 		else:
 			tax_amount = get_tds_amount(ldc, parties, inv, tax_details, tax_deducted, vouchers)
 
@@ -425,7 +428,10 @@
 		):
 			# Get net total again as TDS is calculated on net total
 			# Grand is used to just check for threshold breach
-			net_total = frappe.db.get_value("Purchase Invoice", invoice_filters, "sum(net_total)") or 0.0
+			net_total = 0
+			if vouchers:
+				net_total = frappe.db.get_value("Purchase Invoice", invoice_filters, "sum(net_total)")
+
 			net_total += inv.net_total
 			supp_credit_amt = net_total - cumulative_threshold
 
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 9ede678..95ba3d8 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -648,6 +648,16 @@
 		(now(), frappe.session.user, ref_doc.doctype, ref_doc.name),
 	)
 
+	ple = qb.DocType("Payment Ledger Entry")
+
+	qb.update(ple).set(ple.against_voucher_type, ple.voucher_type).set(
+		ple.against_voucher_no, ple.voucher_no
+	).set(ple.modified, now()).set(ple.modified_by, frappe.session.user).where(
+		(ple.against_voucher_type == ref_doc.doctype)
+		& (ple.against_voucher_no == ref_doc.name)
+		& (ple.delinked == 0)
+	).run()
+
 	if ref_doc.doctype in ("Sales Invoice", "Purchase Invoice"):
 		ref_doc.set("advances", [])
 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index fb8f25a..2193985 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -12,43 +12,24 @@
   "title",
   "naming_series",
   "supplier",
-  "get_items_from_open_material_requests",
   "supplier_name",
+  "order_confirmation_no",
+  "order_confirmation_date",
+  "get_items_from_open_material_requests",
+  "column_break_7",
+  "transaction_date",
+  "schedule_date",
+  "column_break1",
+  "company",
   "apply_tds",
   "tax_withholding_category",
   "is_subcontracted",
   "supplier_warehouse",
-  "column_break1",
-  "company",
-  "transaction_date",
-  "schedule_date",
-  "order_confirmation_no",
-  "order_confirmation_date",
   "amended_from",
   "accounting_dimensions_section",
   "cost_center",
   "dimension_col_break",
   "project",
-  "drop_ship",
-  "customer",
-  "customer_name",
-  "column_break_19",
-  "customer_contact_person",
-  "customer_contact_display",
-  "customer_contact_mobile",
-  "customer_contact_email",
-  "section_addresses",
-  "supplier_address",
-  "address_display",
-  "contact_person",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
-  "col_break_address",
-  "shipping_address",
-  "shipping_address_display",
-  "billing_address",
-  "billing_address_display",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -57,7 +38,6 @@
   "price_list_currency",
   "plc_conversion_rate",
   "ignore_pricing_rule",
-  "section_break_45",
   "before_items_section",
   "scan_barcode",
   "set_from_warehouse",
@@ -67,10 +47,11 @@
   "items",
   "sb_last_purchase",
   "total_qty",
+  "total_net_weight",
+  "column_break_40",
   "base_total",
   "base_net_total",
   "column_break_26",
-  "total_net_weight",
   "total",
   "net_total",
   "section_break_48",
@@ -79,14 +60,13 @@
   "set_reserve_warehouse",
   "supplied_items",
   "taxes_section",
+  "taxes_and_charges",
+  "column_break_53",
   "tax_category",
   "column_break_50",
   "shipping_rule",
   "section_break_52",
-  "taxes_and_charges",
   "taxes",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "totals",
   "base_taxes_and_charges_added",
   "base_taxes_and_charges_deducted",
@@ -95,12 +75,6 @@
   "taxes_and_charges_added",
   "taxes_and_charges_deducted",
   "total_taxes_and_charges",
-  "discount_section",
-  "apply_discount_on",
-  "base_discount_amount",
-  "column_break_45",
-  "additional_discount_percentage",
-  "discount_amount",
   "totals_section",
   "base_grand_total",
   "base_rounding_adjustment",
@@ -113,37 +87,73 @@
   "disable_rounded_total",
   "in_words",
   "advance_paid",
+  "discount_section",
+  "apply_discount_on",
+  "base_discount_amount",
+  "column_break_45",
+  "additional_discount_percentage",
+  "discount_amount",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "address_and_contact_tab",
+  "section_addresses",
+  "supplier_address",
+  "address_display",
+  "col_break_address",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "company_shipping_address_section",
+  "shipping_address",
+  "column_break_99",
+  "shipping_address_display",
+  "company_billing_address_section",
+  "billing_address",
+  "column_break_103",
+  "billing_address_display",
+  "drop_ship",
+  "customer",
+  "customer_name",
+  "column_break_19",
+  "customer_contact_person",
+  "customer_contact_display",
+  "customer_contact_mobile",
+  "customer_contact_email",
+  "terms_tab",
   "payment_schedule_section",
   "payment_terms_template",
   "payment_schedule",
+  "terms_section_break",
+  "tc_name",
+  "terms",
+  "more_info_tab",
   "tracking_section",
   "status",
   "column_break_75",
   "per_billed",
   "per_received",
-  "terms_section_break",
-  "tc_name",
-  "terms",
   "column_break5",
   "letter_head",
-  "select_print_heading",
-  "column_break_86",
-  "language",
   "group_same_items",
+  "column_break_86",
+  "select_print_heading",
+  "language",
   "subscription_section",
   "from_date",
   "to_date",
   "column_break_97",
   "auto_repeat",
   "update_auto_repeat_reference",
-  "more_info",
+  "additional_info_section",
+  "is_internal_supplier",
+  "represents_company",
   "ref_sq",
   "column_break_74",
   "party_account_currency",
-  "is_internal_supplier",
-  "represents_company",
   "inter_company_order_reference",
-  "is_old_subcontracting_flow"
+  "is_old_subcontracting_flow",
+  "dashboard"
  ],
  "fields": [
   {
@@ -267,8 +277,9 @@
    "read_only": 1
   },
   {
+   "depends_on": "eval:doc.customer",
    "fieldname": "drop_ship",
-   "fieldtype": "Section Break",
+   "fieldtype": "Tab Break",
    "label": "Drop Ship"
   },
   {
@@ -299,7 +310,6 @@
   {
    "fieldname": "customer_contact_display",
    "fieldtype": "Small Text",
-   "hidden": 1,
    "label": "Customer Contact",
    "print_hide": 1
   },
@@ -319,10 +329,9 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
    "fieldname": "section_addresses",
    "fieldtype": "Section Break",
-   "label": "Address and Contact"
+   "label": "Supplier Address"
   },
   {
    "fieldname": "supplier_address",
@@ -445,7 +454,6 @@
    "print_hide": 1
   },
   {
-   "description": "Sets 'Warehouse' in each row of the Items table.",
    "fieldname": "set_warehouse",
    "fieldtype": "Link",
    "label": "Set Target Warehouse",
@@ -483,7 +491,6 @@
    "allow_bulk_edit": 1,
    "fieldname": "items",
    "fieldtype": "Table",
-   "label": "Items",
    "oldfieldname": "po_details",
    "oldfieldtype": "Table",
    "options": "Purchase Order Item",
@@ -570,6 +577,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "label": "Total Net Weight",
@@ -579,6 +587,8 @@
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
   },
@@ -633,7 +643,6 @@
   {
    "fieldname": "totals",
    "fieldtype": "Section Break",
-   "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
   },
@@ -698,7 +707,6 @@
    "read_only": 1
   },
   {
-   "depends_on": "total_taxes_and_charges",
    "fieldname": "total_taxes_and_charges",
    "fieldtype": "Currency",
    "label": "Total Taxes and Charges",
@@ -708,7 +716,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "apply_discount_on",
    "fieldname": "discount_section",
    "fieldtype": "Section Break",
    "label": "Additional Discount"
@@ -773,7 +780,6 @@
    "read_only": 1
   },
   {
-   "description": "In Words will be visible once you save the Purchase Order.",
    "fieldname": "base_in_words",
    "fieldtype": "Data",
    "label": "In Words (Company Currency)",
@@ -851,7 +857,6 @@
    "read_only": 1
   },
   {
-   "collapsible": 1,
    "fieldname": "payment_schedule_section",
    "fieldtype": "Section Break",
    "label": "Payment Terms"
@@ -871,11 +876,10 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
    "collapsible_depends_on": "terms",
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
-   "label": "Terms and Conditions",
+   "label": "Terms & Conditions",
    "oldfieldtype": "Section Break",
    "options": "fa fa-legal"
   },
@@ -896,13 +900,6 @@
    "oldfieldtype": "Text Editor"
   },
   {
-   "collapsible": 1,
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Information",
-   "oldfieldtype": "Section Break"
-  },
-  {
    "default": "Draft",
    "fieldname": "status",
    "fieldtype": "Select",
@@ -1023,7 +1020,7 @@
    "collapsible": 1,
    "fieldname": "subscription_section",
    "fieldtype": "Section Break",
-   "label": "Subscription Section"
+   "label": "Auto Repeat"
   },
   {
    "allow_on_submit": 1,
@@ -1098,7 +1095,9 @@
   },
   {
    "fieldname": "before_items_section",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Items"
   },
   {
    "fieldname": "items_col_break",
@@ -1134,10 +1133,6 @@
    "options": "Tax Withholding Category"
   },
   {
-   "fieldname": "section_break_45",
-   "fieldtype": "Section Break"
-  },
-  {
    "collapsible": 1,
    "fieldname": "accounting_dimensions_section",
    "fieldtype": "Section Break",
@@ -1173,13 +1168,71 @@
    "fieldtype": "Link",
    "label": "Set From Warehouse",
    "options": "Warehouse"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "dashboard",
+   "fieldtype": "Tab Break",
+   "label": "Dashboard",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_7",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_40",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_53",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "address_and_contact_tab",
+   "fieldtype": "Tab Break",
+   "label": "Address & Contact"
+  },
+  {
+   "fieldname": "company_shipping_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Shipping Address"
+  },
+  {
+   "fieldname": "company_billing_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Billing Address"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "additional_info_section",
+   "fieldtype": "Section Break",
+   "label": "Additional Info",
+   "oldfieldtype": "Section Break"
+  },
+  {
+   "fieldname": "column_break_99",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_103",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-file-text",
  "idx": 105,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-09-16 17:45:04.954055",
+ "modified": "2022-10-11 13:01:41.674352",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Purchase Order",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index cd58d25..bcedd4d 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -349,7 +349,7 @@
 		update_linked_doc(self.doctype, self.name, self.inter_company_order_reference)
 
 	def on_cancel(self):
-		self.ignore_linked_doctypes = "Payment Ledger Entry"
+		self.ignore_linked_doctypes = ("GL Entry", "Payment Ledger Entry")
 		super(PurchaseOrder, self).on_cancel()
 
 		if self.is_against_so():
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 8d1939a..1636561 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -13,19 +13,13 @@
   "naming_series",
   "supplier",
   "supplier_name",
-  "column_break1",
   "company",
+  "column_break1",
+  "status",
   "transaction_date",
   "valid_till",
   "quotation_number",
   "amended_from",
-  "address_section",
-  "supplier_address",
-  "contact_person",
-  "address_display",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -36,25 +30,23 @@
   "ignore_pricing_rule",
   "items_section",
   "items",
-  "pricing_rule_details",
-  "pricing_rules",
   "section_break_22",
   "total_qty",
+  "total_net_weight",
+  "column_break_26",
   "base_total",
   "base_net_total",
   "column_break_24",
   "total",
   "net_total",
-  "total_net_weight",
   "taxes_section",
+  "taxes_and_charges",
+  "column_break_34",
   "tax_category",
   "column_break_36",
   "shipping_rule",
   "section_break_38",
-  "taxes_and_charges",
   "taxes",
-  "tax_breakup",
-  "other_charges_calculation",
   "totals",
   "base_taxes_and_charges_added",
   "base_taxes_and_charges_deducted",
@@ -80,24 +72,36 @@
   "rounded_total",
   "in_words",
   "disable_rounded_total",
-  "terms_section_break",
+  "tax_breakup",
+  "other_charges_calculation",
+  "pricing_rule_details",
+  "pricing_rules",
+  "address_and_contact_tab",
+  "supplier_address",
+  "address_display",
+  "column_break_72",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "terms_tab",
   "tc_name",
   "terms",
+  "more_info_tab",
   "printing_settings",
-  "select_print_heading",
-  "group_same_items",
-  "column_break_72",
   "letter_head",
+  "group_same_items",
+  "column_break_85",
+  "select_print_heading",
   "language",
   "subscription_section",
   "auto_repeat",
   "update_auto_repeat_reference",
   "more_info",
-  "status",
-  "column_break_57",
   "is_subcontracted",
-  "reference",
-  "opportunity"
+  "column_break_57",
+  "opportunity",
+  "connections_tab"
  ],
  "fields": [
   {
@@ -146,7 +150,7 @@
    "fieldname": "supplier_name",
    "fieldtype": "Data",
    "in_global_search": 1,
-   "label": "Name",
+   "label": "Supplier Name",
    "read_only": 1
   },
   {
@@ -194,12 +198,6 @@
    "search_index": 1
   },
   {
-   "collapsible": 1,
-   "fieldname": "address_section",
-   "fieldtype": "Section Break",
-   "label": "Address and Contact"
-  },
-  {
    "fieldname": "supplier_address",
    "fieldtype": "Link",
    "label": "Supplier Address",
@@ -309,6 +307,8 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Items",
    "oldfieldtype": "Section Break",
    "options": "fa fa-shopping-cart"
   },
@@ -316,7 +316,6 @@
    "allow_bulk_edit": 1,
    "fieldname": "items",
    "fieldtype": "Table",
-   "label": "Items",
    "oldfieldname": "po_details",
    "oldfieldtype": "Table",
    "options": "Supplier Quotation Item",
@@ -394,6 +393,7 @@
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
@@ -417,7 +417,8 @@
   },
   {
    "fieldname": "section_break_38",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1
   },
   {
    "fieldname": "taxes_and_charges",
@@ -523,7 +524,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_41",
    "fieldtype": "Section Break",
    "label": "Additional Discount"
@@ -563,7 +563,8 @@
   },
   {
    "fieldname": "section_break_46",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "label": "Totals"
   },
   {
    "fieldname": "base_grand_total",
@@ -655,18 +656,9 @@
    "label": "Disable Rounded Total"
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "terms",
-   "fieldname": "terms_section_break",
-   "fieldtype": "Section Break",
-   "label": "Terms and Conditions",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-legal"
-  },
-  {
    "fieldname": "tc_name",
    "fieldtype": "Link",
-   "label": "Terms",
+   "label": "Terms Template",
    "oldfieldname": "tc_name",
    "oldfieldtype": "Link",
    "options": "Terms and Conditions",
@@ -729,7 +721,7 @@
   {
    "fieldname": "subscription_section",
    "fieldtype": "Section Break",
-   "label": "Auto Repeat Section"
+   "label": "Auto Repeat"
   },
   {
    "fieldname": "auto_repeat",
@@ -751,7 +743,7 @@
    "collapsible": 1,
    "fieldname": "more_info",
    "fieldtype": "Section Break",
-   "label": "More Information",
+   "label": "Additional Info",
    "oldfieldtype": "Section Break",
    "options": "fa fa-file-text"
   },
@@ -780,11 +772,6 @@
    "print_hide": 1
   },
   {
-   "fieldname": "reference",
-   "fieldtype": "Section Break",
-   "label": "Reference"
-  },
-  {
    "fieldname": "opportunity",
    "fieldtype": "Link",
    "label": "Opportunity",
@@ -803,6 +790,39 @@
    "fieldname": "quotation_number",
    "fieldtype": "Data",
    "label": "Quotation Number"
+  },
+  {
+   "fieldname": "address_and_contact_tab",
+   "fieldtype": "Tab Break",
+   "label": "Address & Contact"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_26",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_34",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_85",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-shopping-cart",
@@ -810,7 +830,7 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-03-14 16:13:20.284572",
+ "modified": "2022-09-27 18:20:09.462037",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Supplier Quotation",
diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py
index a53c42c..804f03d 100644
--- a/erpnext/manufacturing/doctype/work_order/test_work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py
@@ -17,6 +17,7 @@
 	close_work_order,
 	make_job_card,
 	make_stock_entry,
+	make_stock_return_entry,
 	stop_unstop,
 )
 from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
@@ -1408,6 +1409,77 @@
 		)
 		self.assertEqual(manufacture_ste_doc2.items[1].qty, 1)
 
+	def test_non_consumed_material_return_against_work_order(self):
+		frappe.db.set_value(
+			"Manufacturing Settings",
+			None,
+			"backflush_raw_materials_based_on",
+			"Material Transferred for Manufacture",
+		)
+
+		item = make_item(
+			"Test FG Item To Test Return Case",
+			{
+				"is_stock_item": 1,
+			},
+		)
+
+		item_code = item.name
+		bom_doc = make_bom(
+			item=item_code,
+			source_warehouse="Stores - _TC",
+			raw_materials=["Test Batch MCC Keyboard", "Test Serial No BTT Headphone"],
+		)
+
+		# Create a work order
+		wo_doc = make_wo_order_test_record(production_item=item_code, qty=5)
+		wo_doc.save()
+
+		self.assertEqual(wo_doc.bom_no, bom_doc.name)
+
+		# Transfer material for manufacture
+		ste_doc = frappe.get_doc(make_stock_entry(wo_doc.name, "Material Transfer for Manufacture", 5))
+		for row in ste_doc.items:
+			row.qty += 2
+			row.transfer_qty += 2
+			nste_doc = test_stock_entry.make_stock_entry(
+				item_code=row.item_code, target="Stores - _TC", qty=row.qty, basic_rate=100
+			)
+
+			row.batch_no = nste_doc.items[0].batch_no
+			row.serial_no = nste_doc.items[0].serial_no
+
+		ste_doc.save()
+		ste_doc.submit()
+		ste_doc.load_from_db()
+
+		# Create a stock entry to manufacture the item
+		ste_doc = frappe.get_doc(make_stock_entry(wo_doc.name, "Manufacture", 5))
+		for row in ste_doc.items:
+			if row.s_warehouse and not row.t_warehouse:
+				row.qty -= 2
+				row.transfer_qty -= 2
+
+				if row.serial_no:
+					serial_nos = get_serial_nos(row.serial_no)
+					row.serial_no = "\n".join(serial_nos[0:5])
+
+		ste_doc.save()
+		ste_doc.submit()
+
+		wo_doc.load_from_db()
+		for row in wo_doc.required_items:
+			self.assertEqual(row.transferred_qty, 7)
+			self.assertEqual(row.consumed_qty, 5)
+
+		self.assertEqual(wo_doc.status, "Completed")
+		return_ste_doc = make_stock_return_entry(wo_doc.name)
+		return_ste_doc.save()
+
+		self.assertTrue(return_ste_doc.is_return)
+		for row in return_ste_doc.items:
+			self.assertEqual(row.qty, 2)
+
 
 def prepare_data_for_backflush_based_on_materials_transferred():
 	batch_item_doc = make_item(
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index f3640b9..4aab3fa 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -180,6 +180,37 @@
 				frm.trigger("make_bom");
 			});
 		}
+
+		frm.trigger("add_custom_button_to_return_components");
+	},
+
+	add_custom_button_to_return_components: function(frm) {
+		if (frm.doc.docstatus === 1 && in_list(["Closed", "Completed"], frm.doc.status)) {
+			let non_consumed_items = frm.doc.required_items.filter(d =>{
+				return flt(d.consumed_qty) < flt(d.transferred_qty - d.returned_qty)
+			});
+
+			if (non_consumed_items && non_consumed_items.length) {
+				frm.add_custom_button(__("Return Components"), function() {
+					frm.trigger("create_stock_return_entry");
+				}).addClass("btn-primary");
+			}
+		}
+	},
+
+	create_stock_return_entry: function(frm) {
+		frappe.call({
+			method: "erpnext.manufacturing.doctype.work_order.work_order.make_stock_return_entry",
+			args: {
+				"work_order": frm.doc.name,
+			},
+			callback: function(r) {
+				if(!r.exc) {
+					let doc = frappe.model.sync(r.message);
+					frappe.set_route("Form", doc[0].doctype, doc[0].name);
+				}
+			}
+		});
 	},
 
 	make_job_card: function(frm) {
@@ -517,7 +548,8 @@
 erpnext.work_order = {
 	set_custom_buttons: function(frm) {
 		var doc = frm.doc;
-		if (doc.docstatus === 1 && doc.status != "Closed") {
+
+		if (doc.status !== "Closed") {
 			frm.add_custom_button(__('Close'), function() {
 				frappe.confirm(__("Once the Work Order is Closed. It can't be resumed."),
 					() => {
@@ -525,7 +557,9 @@
 					}
 				);
 			}, __("Status"));
+		}
 
+		if (doc.docstatus === 1 && !in_list(["Closed", "Completed"], doc.status)) {
 			if (doc.status != 'Stopped' && doc.status != 'Completed') {
 				frm.add_custom_button(__('Stop'), function() {
 					erpnext.work_order.change_work_order_status(frm, "Stopped");
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 7b86253..1e6d982 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -20,6 +20,7 @@
 	nowdate,
 	time_diff_in_hours,
 )
+from pypika import functions as fn
 
 from erpnext.manufacturing.doctype.bom.bom import (
 	get_bom_item_rate,
@@ -859,6 +860,7 @@
 		if self.docstatus == 1:
 			# calculate transferred qty based on submitted stock entries
 			self.update_transferred_qty_for_required_items()
+			self.update_returned_qty()
 
 			# update in bin
 			self.update_reserved_qty_for_production()
@@ -930,23 +932,62 @@
 			self.set_available_qty()
 
 	def update_transferred_qty_for_required_items(self):
-		"""update transferred qty from submitted stock entries for that item against
-		the work order"""
+		ste = frappe.qb.DocType("Stock Entry")
+		ste_child = frappe.qb.DocType("Stock Entry Detail")
 
-		for d in self.required_items:
-			transferred_qty = frappe.db.sql(
-				"""select sum(qty)
-				from `tabStock Entry` entry, `tabStock Entry Detail` detail
-				where
-					entry.work_order = %(name)s
-					and entry.purpose = 'Material Transfer for Manufacture'
-					and entry.docstatus = 1
-					and detail.parent = entry.name
-					and (detail.item_code = %(item)s or detail.original_item = %(item)s)""",
-				{"name": self.name, "item": d.item_code},
-			)[0][0]
+		query = (
+			frappe.qb.from_(ste)
+			.inner_join(ste_child)
+			.on((ste_child.parent == ste.name))
+			.select(
+				ste_child.item_code,
+				ste_child.original_item,
+				fn.Sum(ste_child.qty).as_("qty"),
+			)
+			.where(
+				(ste.docstatus == 1)
+				& (ste.work_order == self.name)
+				& (ste.purpose == "Material Transfer for Manufacture")
+				& (ste.is_return == 0)
+			)
+			.groupby(ste_child.item_code)
+		)
 
-			d.db_set("transferred_qty", flt(transferred_qty), update_modified=False)
+		data = query.run(as_dict=1) or []
+		transferred_items = frappe._dict({d.original_item or d.item_code: d.qty for d in data})
+
+		for row in self.required_items:
+			row.db_set(
+				"transferred_qty", (transferred_items.get(row.item_code) or 0.0), update_modified=False
+			)
+
+	def update_returned_qty(self):
+		ste = frappe.qb.DocType("Stock Entry")
+		ste_child = frappe.qb.DocType("Stock Entry Detail")
+
+		query = (
+			frappe.qb.from_(ste)
+			.inner_join(ste_child)
+			.on((ste_child.parent == ste.name))
+			.select(
+				ste_child.item_code,
+				ste_child.original_item,
+				fn.Sum(ste_child.qty).as_("qty"),
+			)
+			.where(
+				(ste.docstatus == 1)
+				& (ste.work_order == self.name)
+				& (ste.purpose == "Material Transfer for Manufacture")
+				& (ste.is_return == 1)
+			)
+			.groupby(ste_child.item_code)
+		)
+
+		data = query.run(as_dict=1) or []
+		returned_dict = frappe._dict({d.original_item or d.item_code: d.qty for d in data})
+
+		for row in self.required_items:
+			row.db_set("returned_qty", (returned_dict.get(row.item_code) or 0.0), update_modified=False)
 
 	def update_consumed_qty_for_required_items(self):
 		"""
@@ -1470,3 +1511,25 @@
 			)
 		)
 	).run()[0][0] or 0.0
+
+
+@frappe.whitelist()
+def make_stock_return_entry(work_order):
+	from erpnext.stock.doctype.stock_entry.stock_entry import get_available_materials
+
+	non_consumed_items = get_available_materials(work_order)
+	if not non_consumed_items:
+		return
+
+	wo_doc = frappe.get_cached_doc("Work Order", work_order)
+
+	stock_entry = frappe.new_doc("Stock Entry")
+	stock_entry.from_bom = 1
+	stock_entry.is_return = 1
+	stock_entry.work_order = work_order
+	stock_entry.purpose = "Material Transfer for Manufacture"
+	stock_entry.bom_no = wo_doc.bom_no
+	stock_entry.add_transfered_raw_materials_in_items()
+	stock_entry.set_stock_entry_type()
+
+	return stock_entry
diff --git a/erpnext/manufacturing/doctype/work_order_item/work_order_item.json b/erpnext/manufacturing/doctype/work_order_item/work_order_item.json
index 3acf572..f354d45 100644
--- a/erpnext/manufacturing/doctype/work_order_item/work_order_item.json
+++ b/erpnext/manufacturing/doctype/work_order_item/work_order_item.json
@@ -20,6 +20,7 @@
   "column_break_11",
   "transferred_qty",
   "consumed_qty",
+  "returned_qty",
   "available_qty_at_source_warehouse",
   "available_qty_at_wip_warehouse"
  ],
@@ -97,6 +98,7 @@
    "fieldtype": "Column Break"
   },
   {
+   "columns": 1,
    "depends_on": "eval:!parent.skip_transfer",
    "fieldname": "consumed_qty",
    "fieldtype": "Float",
@@ -127,11 +129,19 @@
    "fieldtype": "Currency",
    "label": "Amount",
    "read_only": 1
+  },
+  {
+   "columns": 1,
+   "fieldname": "returned_qty",
+   "fieldtype": "Float",
+   "in_list_view": 1,
+   "label": "Returned Qty ",
+   "read_only": 1
   }
  ],
  "istable": 1,
  "links": [],
- "modified": "2020-04-13 18:46:32.966416",
+ "modified": "2022-09-28 10:50:43.512562",
  "modified_by": "Administrator",
  "module": "Manufacturing",
  "name": "Work Order Item",
@@ -140,5 +150,6 @@
  "quick_entry": 1,
  "sort_field": "modified",
  "sort_order": "DESC",
+ "states": [],
  "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.js b/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.js
index b2428e8..2fb4ec6 100644
--- a/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.js
+++ b/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.js
@@ -50,7 +50,7 @@
 			label: __("Status"),
 			fieldname: "status",
 			fieldtype: "Select",
-			options: ["In Process", "Completed", "Stopped"]
+			options: ["", "In Process", "Completed", "Stopped"]
 		},
 		{
 			label: __("Excess Materials Consumed"),
diff --git a/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py b/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py
index 8158bc9..14e97d3 100644
--- a/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py
+++ b/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py
@@ -1,6 +1,8 @@
 # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
 # For license information, please see license.txt
 
+from collections import defaultdict
+
 import frappe
 from frappe import _
 
@@ -18,7 +20,11 @@
 	filters = get_filter_condition(report_filters)
 
 	wo_items = {}
-	for d in frappe.get_all("Work Order", filters=filters, fields=fields):
+
+	work_orders = frappe.get_all("Work Order", filters=filters, fields=fields)
+	returned_materials = get_returned_materials(work_orders)
+
+	for d in work_orders:
 		d.extra_consumed_qty = 0.0
 		if d.consumed_qty and d.consumed_qty > d.required_qty:
 			d.extra_consumed_qty = d.consumed_qty - d.required_qty
@@ -39,6 +45,28 @@
 	return data
 
 
+def get_returned_materials(work_orders):
+	raw_materials_qty = defaultdict(float)
+
+	raw_materials = frappe.get_all(
+		"Stock Entry",
+		fields=["`tabStock Entry Detail`.`item_code`", "`tabStock Entry Detail`.`qty`"],
+		filters=[
+			["Stock Entry", "is_return", "=", 1],
+			["Stock Entry Detail", "docstatus", "=", 1],
+			["Stock Entry", "work_order", "in", [d.name for d in work_orders]],
+		],
+	)
+
+	for d in raw_materials:
+		raw_materials_qty[d.item_code] += d.qty
+
+	for row in work_orders:
+		row.returned_qty = 0.0
+		if raw_materials_qty.get(row.raw_material_item_code):
+			row.returned_qty = raw_materials_qty.get(row.raw_material_item_code)
+
+
 def get_fields():
 	return [
 		"`tabWork Order Item`.`parent`",
@@ -65,7 +93,7 @@
 	for field in ["name", "production_item", "company", "status"]:
 		value = report_filters.get(field)
 		if value:
-			key = f"`{field}`"
+			key = f"{field}"
 			filters.update({key: value})
 
 	return filters
@@ -112,4 +140,10 @@
 			"fieldtype": "Float",
 			"width": 100,
 		},
+		{
+			"label": _("Returned Qty"),
+			"fieldname": "returned_qty",
+			"fieldtype": "Float",
+			"width": 100,
+		},
 	]
diff --git a/erpnext/regional/united_arab_emirates/setup.py b/erpnext/regional/united_arab_emirates/setup.py
index be621bc..36a0795 100644
--- a/erpnext/regional/united_arab_emirates/setup.py
+++ b/erpnext/regional/united_arab_emirates/setup.py
@@ -37,7 +37,7 @@
 			fieldname="vat_section",
 			label="VAT Details",
 			fieldtype="Section Break",
-			insert_after="group_same_items",
+			insert_after="language",
 			print_hide=1,
 			collapsible=1,
 		),
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index c58a46b..fa64b16 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -15,26 +15,13 @@
   "quotation_to",
   "party_name",
   "customer_name",
-  "column_break1",
-  "amended_from",
-  "company",
+  "column_break_7",
   "transaction_date",
   "valid_till",
+  "column_break1",
   "order_type",
-  "contact_section",
-  "customer_address",
-  "address_display",
-  "contact_person",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
-  "col_break98",
-  "shipping_address_name",
-  "shipping_address",
-  "company_address",
-  "company_address_display",
-  "customer_group",
-  "territory",
+  "company",
+  "amended_from",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -43,79 +30,105 @@
   "price_list_currency",
   "plc_conversion_rate",
   "ignore_pricing_rule",
-  "section_break_33",
-  "scan_barcode",
   "items_section",
+  "scan_barcode",
   "items",
-  "bundle_items_section",
-  "packed_items",
-  "pricing_rule_details",
-  "pricing_rules",
   "sec_break23",
   "total_qty",
+  "total_net_weight",
+  "column_break_28",
   "base_total",
   "base_net_total",
-  "column_break_28",
+  "column_break_31",
   "total",
   "net_total",
-  "total_net_weight",
   "taxes_section",
+  "taxes_and_charges",
+  "column_break_36",
   "tax_category",
   "column_break_34",
   "shipping_rule",
   "section_break_36",
-  "taxes_and_charges",
   "taxes",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "section_break_39",
   "base_total_taxes_and_charges",
   "column_break_42",
   "total_taxes_and_charges",
-  "section_break_44",
-  "coupon_code",
-  "referral_sales_partner",
-  "apply_discount_on",
-  "base_discount_amount",
-  "column_break_46",
-  "additional_discount_percentage",
-  "discount_amount",
   "totals",
   "base_grand_total",
   "base_rounding_adjustment",
-  "base_in_words",
   "base_rounded_total",
+  "base_in_words",
   "column_break3",
   "grand_total",
   "rounding_adjustment",
   "rounded_total",
   "in_words",
+  "section_break_44",
+  "apply_discount_on",
+  "base_discount_amount",
+  "coupon_code",
+  "column_break_46",
+  "additional_discount_percentage",
+  "discount_amount",
+  "referral_sales_partner",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "bundle_items_section",
+  "packed_items",
+  "pricing_rule_details",
+  "pricing_rules",
+  "address_and_contact_tab",
+  "billing_address_section",
+  "customer_address",
+  "address_display",
+  "col_break98",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "shipping_address_section",
+  "shipping_address_name",
+  "column_break_81",
+  "shipping_address",
+  "company_address_section",
+  "company_address",
+  "column_break_87",
+  "company_address_display",
+  "terms_tab",
   "payment_schedule_section",
   "payment_terms_template",
   "payment_schedule",
   "terms_section_break",
   "tc_name",
   "terms",
+  "more_info_tab",
+  "subscription_section",
+  "auto_repeat",
+  "update_auto_repeat_reference",
   "print_settings",
   "letter_head",
   "group_same_items",
   "column_break_73",
   "select_print_heading",
   "language",
-  "subscription_section",
-  "auto_repeat",
-  "update_auto_repeat_reference",
-  "more_info",
+  "lost_reasons_section",
+  "lost_reasons",
+  "competitors",
+  "column_break_117",
+  "order_lost_reason",
+  "additional_info_section",
+  "status",
+  "customer_group",
+  "territory",
+  "column_break_108",
   "campaign",
   "source",
-  "order_lost_reason",
   "column_break4",
-  "status",
-  "enq_det",
-  "supplier_quotation",
   "opportunity",
-  "lost_reasons",
-  "competitors"
+  "supplier_quotation",
+  "enq_det",
+  "connections_tab"
  ],
  "fields": [
   {
@@ -242,14 +255,6 @@
    "reqd": 1
   },
   {
-   "collapsible": 1,
-   "depends_on": "party_name",
-   "fieldname": "contact_section",
-   "fieldtype": "Section Break",
-   "label": "Address and Contact",
-   "options": "fa fa-bullhorn"
-  },
-  {
    "fieldname": "customer_address",
    "fieldtype": "Link",
    "label": "Customer Address",
@@ -296,7 +301,7 @@
    "read_only": 1
   },
   {
-   "depends_on": "eval:doc.quotation_to=='Customer' && doc.party_name",
+   "depends_on": "eval:(doc.quotation_to=='Customer' && doc.party_name)",
    "fieldname": "col_break98",
    "fieldtype": "Column Break",
    "width": "50%"
@@ -316,7 +321,7 @@
    "read_only": 1
   },
   {
-   "depends_on": "eval:doc.quotation_to=='Customer' && doc.party_name",
+   "depends_on": "eval:(doc.quotation_to=='Customer' && doc.party_name)",
    "fieldname": "customer_group",
    "fieldtype": "Link",
    "hidden": 1,
@@ -408,6 +413,8 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Items",
    "oldfieldtype": "Section Break",
    "options": "fa fa-shopping-cart"
   },
@@ -415,7 +422,6 @@
    "allow_bulk_edit": 1,
    "fieldname": "items",
    "fieldtype": "Table",
-   "label": "Items",
    "oldfieldname": "quotation_details",
    "oldfieldtype": "Table",
    "options": "Quotation Item",
@@ -423,6 +429,7 @@
    "width": "40px"
   },
   {
+   "collapsible": 1,
    "fieldname": "pricing_rule_details",
    "fieldtype": "Section Break",
    "label": "Pricing Rules"
@@ -483,6 +490,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "label": "Total Net Weight",
@@ -492,6 +500,7 @@
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
@@ -517,7 +526,8 @@
   },
   {
    "fieldname": "section_break_36",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1
   },
   {
    "fieldname": "taxes_and_charges",
@@ -579,10 +589,9 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_44",
    "fieldtype": "Section Break",
-   "label": "Additional Discount and Coupon Code"
+   "label": "Additional Discount"
   },
   {
    "fieldname": "coupon_code",
@@ -632,6 +641,7 @@
   {
    "fieldname": "totals",
    "fieldtype": "Section Break",
+   "label": "Totals",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
    "print_hide": 1
@@ -657,7 +667,6 @@
    "read_only": 1
   },
   {
-   "description": "In Words will be visible once you save the Quotation.",
    "fieldname": "base_in_words",
    "fieldtype": "Data",
    "label": "In Words (Company Currency)",
@@ -665,8 +674,7 @@
    "oldfieldname": "in_words",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1,
-   "width": "200px"
+   "read_only": 1
   },
   {
    "fieldname": "base_rounded_total",
@@ -749,7 +757,6 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
    "collapsible_depends_on": "terms",
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
@@ -824,7 +831,7 @@
   {
    "fieldname": "subscription_section",
    "fieldtype": "Section Break",
-   "label": "Auto Repeat Section"
+   "label": "Auto Repeat"
   },
   {
    "fieldname": "auto_repeat",
@@ -837,21 +844,12 @@
   },
   {
    "allow_on_submit": 1,
-   "depends_on": "eval: doc.auto_repeat",
+   "depends_on": "eval:doc.auto_repeat",
    "fieldname": "update_auto_repeat_reference",
    "fieldtype": "Button",
    "label": "Update Auto Repeat Reference"
   },
   {
-   "collapsible": 1,
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Information",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-file-text",
-   "print_hide": 1
-  },
-  {
    "fieldname": "campaign",
    "fieldtype": "Link",
    "label": "Campaign",
@@ -871,7 +869,7 @@
   },
   {
    "allow_on_submit": 1,
-   "depends_on": "eval:doc.status===\"Lost\"",
+   "depends_on": "eval:doc.status=='Lost'",
    "fieldname": "order_lost_reason",
    "fieldtype": "Small Text",
    "label": "Detailed Reason",
@@ -934,7 +932,6 @@
    "read_only": 1
   },
   {
-   "depends_on": "packed_items",
    "fieldname": "packed_items",
    "fieldtype": "Table",
    "label": "Bundle Items",
@@ -943,7 +940,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "packed_items",
    "depends_on": "packed_items",
    "fieldname": "bundle_items_section",
    "fieldtype": "Section Break",
@@ -971,21 +967,98 @@
    "read_only": 1
   },
   {
-   "fieldname": "section_break_33",
-   "fieldtype": "Section Break"
-  },
-  {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
    "label": "Scan Barcode",
    "options": "Barcode"
+  },
+  {
+   "fieldname": "address_and_contact_tab",
+   "fieldtype": "Tab Break",
+   "label": "Address & Contact"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_7",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_31",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_36",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "billing_address_section",
+   "fieldtype": "Section Break",
+   "label": "Billing Address",
+   "options": "fa fa-bullhorn"
+  },
+  {
+   "fieldname": "shipping_address_section",
+   "fieldtype": "Section Break",
+   "label": "Shipping Address"
+  },
+  {
+   "fieldname": "column_break_81",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "company_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Address"
+  },
+  {
+   "fieldname": "column_break_87",
+   "fieldtype": "Column Break"
+  },
+  {
+   "collapsible": 1,
+   "depends_on": "eval:(doc.lost_reasons || doc.order_lost_reason)",
+   "fieldname": "lost_reasons_section",
+   "fieldtype": "Section Break",
+   "label": "Lost Reasons"
+  },
+  {
+   "fieldname": "column_break_117",
+   "fieldtype": "Column Break"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "additional_info_section",
+   "fieldtype": "Section Break",
+   "label": "Additional Info",
+   "oldfieldtype": "Section Break",
+   "options": "fa fa-file-text",
+   "print_hide": 1
+  },
+  {
+   "fieldname": "column_break_108",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-shopping-cart",
  "idx": 82,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-09-16 17:44:43.221804",
+ "modified": "2022-10-11 13:06:33.479650",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Quotation",
@@ -1083,4 +1156,4 @@
  "states": [],
  "timeline_field": "party_name",
  "title_field": "title"
-}
+}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index ff269d0..e6ff39d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -15,37 +15,25 @@
   "naming_series",
   "customer",
   "customer_name",
+  "tax_id",
   "order_type",
-  "skip_delivery_note",
-  "column_break1",
-  "amended_from",
-  "company",
+  "column_break_7",
   "transaction_date",
   "delivery_date",
+  "column_break1",
   "po_no",
   "po_date",
-  "tax_id",
+  "company",
+  "skip_delivery_note",
+  "amended_from",
   "accounting_dimensions_section",
   "cost_center",
   "dimension_col_break",
   "project",
-  "contact_info",
-  "customer_address",
-  "address_display",
-  "contact_person",
-  "contact_display",
-  "contact_phone",
-  "contact_mobile",
-  "contact_email",
-  "company_address",
-  "company_address_display",
-  "col_break46",
-  "shipping_address_name",
-  "shipping_address",
-  "dispatch_address_name",
-  "dispatch_address",
-  "customer_group",
-  "territory",
+  "column_break_77",
+  "source",
+  "campaign",
+  "custom_dimensions_section",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -55,46 +43,32 @@
   "plc_conversion_rate",
   "ignore_pricing_rule",
   "sec_warehouse",
+  "scan_barcode",
+  "column_break_28",
   "set_warehouse",
   "items_section",
-  "scan_barcode",
   "items",
-  "packing_list",
-  "packed_items",
-  "pricing_rule_details",
-  "pricing_rules",
   "section_break_31",
-  "column_break_33a",
   "total_qty",
+  "total_net_weight",
+  "column_break_33",
   "base_total",
   "base_net_total",
-  "column_break_33",
-  "total_net_weight",
+  "column_break_33a",
   "total",
   "net_total",
   "taxes_section",
-  "tax_category",
+  "taxes_and_charges",
   "column_break_38",
+  "tax_category",
+  "column_break_49",
   "shipping_rule",
   "section_break_40",
-  "taxes_and_charges",
   "taxes",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "section_break_43",
   "base_total_taxes_and_charges",
   "column_break_46",
   "total_taxes_and_charges",
-  "loyalty_points_redemption",
-  "loyalty_points",
-  "loyalty_amount",
-  "section_break_48",
-  "coupon_code",
-  "apply_discount_on",
-  "base_discount_amount",
-  "column_break_50",
-  "additional_discount_percentage",
-  "discount_amount",
   "totals",
   "base_grand_total",
   "base_rounding_adjustment",
@@ -107,26 +81,49 @@
   "in_words",
   "advance_paid",
   "disable_rounded_total",
+  "section_break_48",
+  "apply_discount_on",
+  "base_discount_amount",
+  "coupon_code",
+  "column_break_50",
+  "additional_discount_percentage",
+  "discount_amount",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "packing_list",
+  "packed_items",
+  "pricing_rule_details",
+  "pricing_rules",
+  "contact_info",
+  "billing_address_column",
+  "customer_address",
+  "address_display",
+  "customer_group",
+  "territory",
+  "column_break_84",
+  "contact_person",
+  "contact_display",
+  "contact_phone",
+  "contact_mobile",
+  "contact_email",
+  "shipping_address_column",
+  "shipping_address_name",
+  "shipping_address",
+  "column_break_93",
+  "dispatch_address_name",
+  "dispatch_address",
+  "col_break46",
+  "company_address",
+  "column_break_92",
+  "company_address_display",
   "payment_schedule_section",
+  "payment_terms_section",
   "payment_terms_template",
   "payment_schedule",
   "terms_section_break",
   "tc_name",
   "terms",
   "more_info",
-  "is_internal_customer",
-  "represents_company",
-  "inter_company_order_reference",
-  "party_account_currency",
-  "column_break_77",
-  "source",
-  "campaign",
-  "printing_details",
-  "language",
-  "letter_head",
-  "column_break4",
-  "select_print_heading",
-  "group_same_items",
   "section_break_78",
   "status",
   "delivery_status",
@@ -143,12 +140,29 @@
   "total_commission",
   "section_break1",
   "sales_team",
+  "loyalty_points_redemption",
+  "loyalty_points",
+  "column_break_116",
+  "loyalty_amount",
   "subscription_section",
   "from_date",
   "to_date",
   "column_break_108",
   "auto_repeat",
-  "update_auto_repeat_reference"
+  "update_auto_repeat_reference",
+  "printing_details",
+  "letter_head",
+  "group_same_items",
+  "column_break4",
+  "select_print_heading",
+  "language",
+  "additional_info_section",
+  "is_internal_customer",
+  "represents_company",
+  "column_break_152",
+  "inter_company_order_reference",
+  "party_account_currency",
+  "connections_tab"
  ],
  "fields": [
   {
@@ -334,10 +348,10 @@
    "collapsible": 1,
    "depends_on": "customer",
    "fieldname": "contact_info",
-   "fieldtype": "Section Break",
+   "fieldtype": "Tab Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Address and Contact",
+   "label": "Address & Contact",
    "options": "fa fa-bullhorn"
   },
   {
@@ -414,9 +428,10 @@
   },
   {
    "fieldname": "col_break46",
-   "fieldtype": "Column Break",
+   "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
+   "label": "Company Address",
    "width": "50%"
   },
   {
@@ -550,8 +565,10 @@
   {
    "fieldname": "sec_warehouse",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "label": "Items"
   },
   {
    "fieldname": "set_warehouse",
@@ -565,6 +582,7 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
    "hide_seconds": 1,
    "oldfieldtype": "Section Break",
@@ -675,6 +693,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "hide_days": 1,
@@ -688,7 +707,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Taxes and Charges",
+   "label": "Taxes",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
   },
@@ -720,6 +739,7 @@
   {
    "fieldname": "section_break_40",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "hide_days": 1,
    "hide_seconds": 1
   },
@@ -804,7 +824,7 @@
    "hidden": 1,
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Loyalty Points Redemption",
+   "label": "Loyalty Points",
    "print_hide": 1
   },
   {
@@ -828,12 +848,11 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_48",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Additional Discount and Coupon Code"
+   "label": "Additional Discount"
   },
   {
    "fieldname": "coupon_code",
@@ -891,6 +910,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
+   "label": "Totals",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
    "print_hide": 1
@@ -1045,10 +1065,10 @@
   },
   {
    "fieldname": "payment_schedule_section",
-   "fieldtype": "Section Break",
+   "fieldtype": "Tab Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Payment Terms"
+   "label": "Terms"
   },
   {
    "fieldname": "payment_terms_template",
@@ -1070,13 +1090,12 @@
    "print_hide": 1
   },
   {
-   "collapsible": 1,
    "collapsible_depends_on": "terms",
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Terms and Conditions",
+   "label": "Terms & Conditions",
    "oldfieldtype": "Section Break",
    "options": "fa fa-legal"
   },
@@ -1104,10 +1123,10 @@
    "collapsible": 1,
    "collapsible_depends_on": "project",
    "fieldname": "more_info",
-   "fieldtype": "Section Break",
+   "fieldtype": "Tab Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "More Information",
+   "label": "More Info",
    "oldfieldtype": "Section Break",
    "options": "fa fa-file-text",
    "print_hide": 1
@@ -1122,7 +1141,6 @@
    "read_only": 1
   },
   {
-   "description": "Track this Sales Order against any Project",
    "fieldname": "project",
    "fieldtype": "Link",
    "hide_days": 1,
@@ -1240,7 +1258,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Billing and Delivery Status",
+   "label": "Status",
    "oldfieldtype": "Column Break",
    "print_hide": 1,
    "width": "50%"
@@ -1410,7 +1428,7 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Auto Repeat Section",
+   "label": "Auto Repeat",
    "no_copy": 1,
    "print_hide": 1,
    "read_only": 1
@@ -1542,13 +1560,76 @@
   {
    "fieldname": "dimension_col_break",
    "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_7",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_28",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_49",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "payment_terms_section",
+   "fieldtype": "Section Break",
+   "label": "Payment Terms"
+  },
+  {
+   "fieldname": "column_break_116",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "billing_address_column",
+   "fieldtype": "Section Break",
+   "label": "Billing Address"
+  },
+  {
+   "fieldname": "shipping_address_column",
+   "fieldtype": "Section Break",
+   "label": "Shipping Address"
+  },
+  {
+   "fieldname": "column_break_93",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_84",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_92",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "custom_dimensions_section",
+   "fieldtype": "Section Break"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "additional_info_section",
+   "fieldtype": "Section Break",
+   "label": "Additional Info"
+  },
+  {
+   "fieldname": "column_break_152",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-file-text",
  "idx": 105,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-09-16 17:43:57.007441",
+ "modified": "2022-10-11 13:06:10.469796",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Sales Order",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index a8f907e..0ca3e69 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -8,46 +8,29 @@
  "document_type": "Document",
  "engine": "InnoDB",
  "field_order": [
-  "delivery_to_section",
-  "column_break0",
   "title",
   "naming_series",
   "customer",
+  "tax_id",
   "customer_name",
   "column_break1",
-  "amended_from",
-  "company",
   "posting_date",
   "posting_time",
   "set_posting_time",
+  "column_break_10",
+  "company",
+  "amended_from",
   "is_return",
   "issue_credit_note",
   "return_against",
   "accounting_dimensions_section",
   "cost_center",
-  "dimension_col_break",
+  "column_break_18",
   "project",
-  "customer_po_details",
-  "po_no",
-  "column_break_17",
-  "po_date",
-  "section_break_18",
-  "pick_list",
-  "contact_info",
-  "shipping_address_name",
-  "shipping_address",
-  "dispatch_address_name",
-  "dispatch_address",
-  "contact_person",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
-  "col_break21",
-  "customer_address",
-  "tax_id",
-  "address_display",
-  "company_address",
-  "company_address_display",
+  "dimension_col_break",
+  "campaign",
+  "source",
+  "custom_dimensions_section",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -56,45 +39,35 @@
   "price_list_currency",
   "plc_conversion_rate",
   "ignore_pricing_rule",
-  "sec_warehouse",
-  "set_warehouse",
-  "col_break_warehouse",
-  "set_target_warehouse",
   "items_section",
   "scan_barcode",
+  "pick_list",
+  "col_break_warehouse",
+  "set_warehouse",
+  "set_target_warehouse",
+  "section_break_30",
   "items",
-  "pricing_rule_details",
-  "pricing_rules",
-  "packing_list",
-  "packed_items",
-  "product_bundle_help",
   "section_break_31",
   "total_qty",
+  "total_net_weight",
+  "column_break_35",
   "base_total",
   "base_net_total",
   "column_break_33",
-  "total_net_weight",
   "total",
   "net_total",
   "taxes_section",
+  "taxes_and_charges",
+  "column_break_43",
   "tax_category",
   "column_break_39",
   "shipping_rule",
   "section_break_41",
-  "taxes_and_charges",
   "taxes",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "section_break_44",
   "base_total_taxes_and_charges",
   "column_break_47",
   "total_taxes_and_charges",
-  "section_break_49",
-  "apply_discount_on",
-  "base_discount_amount",
-  "column_break_51",
-  "additional_discount_percentage",
-  "discount_amount",
   "totals",
   "base_grand_total",
   "base_rounding_adjustment",
@@ -106,9 +79,50 @@
   "rounded_total",
   "in_words",
   "disable_rounded_total",
-  "terms_section_break",
+  "section_break_49",
+  "apply_discount_on",
+  "base_discount_amount",
+  "column_break_51",
+  "additional_discount_percentage",
+  "discount_amount",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "packing_list",
+  "packed_items",
+  "product_bundle_help",
+  "pricing_rule_details",
+  "pricing_rules",
+  "address_and_contact_tab",
+  "contact_info",
+  "customer_address",
+  "address_display",
+  "col_break21",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "shipping_address_section",
+  "shipping_address_name",
+  "shipping_address",
+  "column_break_95",
+  "dispatch_address_name",
+  "dispatch_address",
+  "company_address_section",
+  "company_address",
+  "column_break_101",
+  "company_address_display",
+  "terms_tab",
   "tc_name",
   "terms",
+  "more_info_tab",
+  "section_break_83",
+  "per_billed",
+  "status",
+  "column_break_112",
+  "per_installed",
+  "installation_status",
+  "column_break_89",
+  "per_returned",
   "transporter_info",
   "transporter",
   "driver",
@@ -118,57 +132,41 @@
   "transporter_name",
   "driver_name",
   "lr_date",
-  "more_info",
-  "campaign",
-  "source",
-  "column_break5",
-  "is_internal_customer",
-  "represents_company",
-  "inter_company_reference",
-  "per_billed",
-  "customer_group",
-  "territory",
-  "printing_details",
-  "letter_head",
-  "select_print_heading",
-  "language",
-  "column_break_88",
-  "print_without_amount",
-  "group_same_items",
-  "section_break_83",
-  "status",
-  "per_installed",
-  "installation_status",
-  "column_break_89",
-  "per_returned",
-  "excise_page",
-  "instructions",
-  "subscription_section",
-  "auto_repeat",
+  "customer_po_details",
+  "po_no",
+  "column_break_17",
+  "po_date",
   "sales_team_section_break",
   "sales_partner",
-  "column_break7",
   "amount_eligible_for_commission",
+  "column_break7",
   "commission_rate",
   "total_commission",
   "section_break1",
-  "sales_team"
+  "sales_team",
+  "subscription_section",
+  "auto_repeat",
+  "printing_details",
+  "letter_head",
+  "print_without_amount",
+  "group_same_items",
+  "column_break_88",
+  "select_print_heading",
+  "language",
+  "more_info",
+  "is_internal_customer",
+  "represents_company",
+  "inter_company_reference",
+  "customer_group",
+  "territory",
+  "column_break5",
+  "excise_page",
+  "instructions",
+  "connections_tab",
+  "column_break_25"
  ],
  "fields": [
   {
-   "fieldname": "delivery_to_section",
-   "fieldtype": "Section Break",
-   "label": "Delivery To",
-   "options": "fa fa-user"
-  },
-  {
-   "fieldname": "column_break0",
-   "fieldtype": "Column Break",
-   "oldfieldtype": "Column Break",
-   "print_width": "50%",
-   "width": "50%"
-  },
-  {
    "allow_on_submit": 1,
    "default": "{customer_name}",
    "fieldname": "title",
@@ -337,11 +335,10 @@
    "width": "100px"
   },
   {
-   "collapsible": 1,
    "depends_on": "customer",
    "fieldname": "contact_info",
    "fieldtype": "Section Break",
-   "label": "Address and Contact",
+   "label": "Billing Address",
    "options": "fa fa-bullhorn"
   },
   {
@@ -494,10 +491,6 @@
    "print_hide": 1
   },
   {
-   "fieldname": "sec_warehouse",
-   "fieldtype": "Section Break"
-  },
-  {
    "fieldname": "set_warehouse",
    "fieldtype": "Link",
    "label": "Set Source Warehouse",
@@ -511,6 +504,8 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Items",
    "oldfieldtype": "Section Break",
    "options": "fa fa-shopping-cart"
   },
@@ -524,7 +519,6 @@
    "allow_bulk_edit": 1,
    "fieldname": "items",
    "fieldtype": "Table",
-   "label": "Items",
    "oldfieldname": "delivery_note_details",
    "oldfieldtype": "Table",
    "options": "Delivery Note Item",
@@ -619,6 +613,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "label": "Total Net Weight",
@@ -628,6 +623,7 @@
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "label": "Taxes and Charges",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
@@ -653,10 +649,10 @@
   },
   {
    "fieldname": "section_break_41",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1
   },
   {
-   "description": "If you have created a standard template in Sales Taxes and Charges Template, select one and click on the button below.",
    "fieldname": "taxes_and_charges",
    "fieldtype": "Link",
    "label": "Sales Taxes and Charges Template",
@@ -668,7 +664,6 @@
   {
    "fieldname": "taxes",
    "fieldtype": "Table",
-   "label": "Sales Taxes and Charges",
    "oldfieldname": "other_charges",
    "oldfieldtype": "Table",
    "options": "Sales Taxes and Charges"
@@ -718,7 +713,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_49",
    "fieldtype": "Section Break",
    "label": "Additional Discount"
@@ -759,6 +753,7 @@
   {
    "fieldname": "totals",
    "fieldtype": "Section Break",
+   "label": "Totals",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money"
   },
@@ -864,15 +859,6 @@
    "width": "150px"
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "terms",
-   "fieldname": "terms_section_break",
-   "fieldtype": "Section Break",
-   "label": "Terms and Conditions",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-legal"
-  },
-  {
    "fieldname": "tc_name",
    "fieldtype": "Link",
    "label": "Terms",
@@ -965,13 +951,12 @@
    "collapsible": 1,
    "fieldname": "more_info",
    "fieldtype": "Section Break",
-   "label": "More Information",
+   "label": "Additional Info",
    "oldfieldtype": "Section Break",
    "options": "fa fa-file-text",
    "print_hide": 1
   },
   {
-   "description": "Track this Delivery Note against any Project",
    "fieldname": "project",
    "fieldtype": "Link",
    "label": "Project",
@@ -1110,7 +1095,6 @@
   },
   {
    "depends_on": "eval:!doc.__islocal",
-   "description": "% of materials delivered against this Delivery Note",
    "fieldname": "per_installed",
    "fieldtype": "Percent",
    "in_list_view": 1,
@@ -1238,10 +1222,6 @@
    "read_only": 1
   },
   {
-   "fieldname": "section_break_18",
-   "fieldtype": "Section Break"
-  },
-  {
    "default": "0",
    "fetch_from": "customer.is_internal_customer",
    "fieldname": "is_internal_customer",
@@ -1329,13 +1309,85 @@
   {
    "fieldname": "dimension_col_break",
    "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "address_and_contact_tab",
+   "fieldtype": "Tab Break",
+   "label": "Address & Contact"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_10",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_25",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "section_break_30",
+   "fieldtype": "Section Break",
+   "hide_border": 1
+  },
+  {
+   "fieldname": "column_break_35",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_43",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "custom_dimensions_section",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "shipping_address_section",
+   "fieldtype": "Section Break",
+   "label": "Shipping Address"
+  },
+  {
+   "fieldname": "column_break_95",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "company_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Address"
+  },
+  {
+   "fieldname": "column_break_101",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_112",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_18",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-truck",
  "idx": 146,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-09-16 17:46:17.701904",
+ "modified": "2022-10-11 13:06:58.655635",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Delivery Note",
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 3593130..413c373 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -11,34 +11,40 @@
   "naming_series",
   "title",
   "material_request_type",
-  "transfer_status",
   "customer",
-  "status",
+  "company",
   "column_break_2",
   "transaction_date",
   "schedule_date",
-  "company",
   "amended_from",
   "warehouse_section",
+  "scan_barcode",
+  "column_break_13",
   "set_from_warehouse",
   "column_break5",
   "set_warehouse",
   "items_section",
-  "scan_barcode",
   "items",
-  "more_info",
-  "per_ordered",
-  "column_break2",
-  "per_received",
-  "printing_details",
-  "letter_head",
-  "select_print_heading",
+  "terms_tab",
   "terms_section_break",
   "tc_name",
   "terms",
+  "more_info_tab",
+  "status_section",
+  "status",
+  "per_ordered",
+  "column_break2",
+  "transfer_status",
+  "per_received",
+  "printing_details",
+  "letter_head",
+  "column_break_31",
+  "select_print_heading",
   "reference",
   "job_card",
-  "work_order"
+  "column_break_35",
+  "work_order",
+  "connections_tab"
  ],
  "fields": [
   {
@@ -148,14 +154,6 @@
    "reqd": 1
   },
   {
-   "collapsible": 1,
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Information",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-file-text"
-  },
-  {
    "default": "Today",
    "fieldname": "transaction_date",
    "fieldtype": "Date",
@@ -239,7 +237,6 @@
    "collapsible_depends_on": "terms",
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
-   "label": "Terms and Conditions",
    "oldfieldtype": "Section Break",
    "options": "fa fa-legal"
   },
@@ -277,10 +274,10 @@
   {
    "fieldname": "warehouse_section",
    "fieldtype": "Section Break",
-   "label": "Warehouse"
+   "hide_border": 1,
+   "label": "Items"
   },
   {
-   "description": "Sets 'Target Warehouse' in each row of the Items table.",
    "fieldname": "set_warehouse",
    "fieldtype": "Link",
    "in_list_view": 1,
@@ -296,7 +293,6 @@
   },
   {
    "depends_on": "eval:doc.material_request_type == 'Material Transfer'",
-   "description": "Sets 'Source Warehouse' in each row of the Items table.",
    "fieldname": "set_from_warehouse",
    "fieldtype": "Link",
    "label": "Set Source Warehouse",
@@ -317,13 +313,49 @@
    "label": "Work Order",
    "options": "Work Order",
    "read_only": 1
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "status_section",
+   "fieldtype": "Section Break",
+   "label": "Status",
+   "oldfieldtype": "Section Break",
+   "options": "fa fa-file-text"
+  },
+  {
+   "fieldname": "column_break_31",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_35",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_13",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-ticket",
  "idx": 70,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-08-25 11:49:28.155048",
+ "modified": "2022-09-27 17:58:26.366469",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Material Request",
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index acaac92..3141212 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -17,10 +17,11 @@
   "supplier_name",
   "supplier_delivery_note",
   "column_break1",
-  "company",
   "posting_date",
   "posting_time",
   "set_posting_time",
+  "column_break_12",
+  "company",
   "apply_putaway_rule",
   "is_return",
   "return_against",
@@ -28,18 +29,6 @@
   "cost_center",
   "dimension_col_break",
   "project",
-  "section_addresses",
-  "supplier_address",
-  "contact_person",
-  "address_display",
-  "contact_display",
-  "contact_mobile",
-  "contact_email",
-  "col_break_address",
-  "shipping_address",
-  "shipping_address_display",
-  "billing_address",
-  "billing_address_display",
   "currency_and_price_list",
   "currency",
   "conversion_rate",
@@ -49,37 +38,33 @@
   "plc_conversion_rate",
   "ignore_pricing_rule",
   "sec_warehouse",
+  "scan_barcode",
+  "column_break_31",
   "set_warehouse",
-  "rejected_warehouse",
-  "col_break_warehouse",
   "set_from_warehouse",
+  "col_break_warehouse",
+  "rejected_warehouse",
   "is_subcontracted",
   "supplier_warehouse",
   "items_section",
-  "scan_barcode",
   "items",
   "section_break0",
   "total_qty",
+  "total_net_weight",
+  "column_break_43",
   "base_total",
   "base_net_total",
   "column_break_27",
-  "total_net_weight",
   "total",
   "net_total",
-  "pricing_rule_details",
-  "pricing_rules",
-  "raw_material_details",
-  "get_current_stock",
-  "supplied_items",
   "taxes_charges_section",
-  "tax_category",
+  "taxes_and_charges",
   "shipping_col",
+  "tax_category",
+  "column_break_53",
   "shipping_rule",
   "taxes_section",
-  "taxes_and_charges",
   "taxes",
-  "sec_tax_breakup",
-  "other_charges_calculation",
   "totals",
   "base_taxes_and_charges_added",
   "base_taxes_and_charges_deducted",
@@ -88,53 +73,81 @@
   "taxes_and_charges_added",
   "taxes_and_charges_deducted",
   "total_taxes_and_charges",
-  "section_break_42",
-  "apply_discount_on",
-  "base_discount_amount",
-  "column_break_44",
-  "additional_discount_percentage",
-  "discount_amount",
   "section_break_46",
   "base_grand_total",
   "base_rounding_adjustment",
-  "base_in_words",
   "base_rounded_total",
+  "base_in_words",
   "column_break_50",
   "grand_total",
   "rounding_adjustment",
   "rounded_total",
   "in_words",
   "disable_rounded_total",
-  "terms_section_break",
+  "section_break_42",
+  "apply_discount_on",
+  "base_discount_amount",
+  "column_break_44",
+  "additional_discount_percentage",
+  "discount_amount",
+  "sec_tax_breakup",
+  "other_charges_calculation",
+  "pricing_rule_details",
+  "pricing_rules",
+  "raw_material_details",
+  "get_current_stock",
+  "supplied_items",
+  "address_and_contact_tab",
+  "section_addresses",
+  "supplier_address",
+  "address_display",
+  "col_break_address",
+  "contact_person",
+  "contact_display",
+  "contact_mobile",
+  "contact_email",
+  "section_break_98",
+  "shipping_address",
+  "column_break_100",
+  "shipping_address_display",
+  "billing_address_section",
+  "billing_address",
+  "column_break_104",
+  "billing_address_display",
+  "terms_tab",
   "tc_name",
   "terms",
-  "more_info",
+  "more_info_tab",
+  "status_section",
   "status",
-  "amended_from",
-  "range",
   "column_break4",
   "per_billed",
   "per_returned",
-  "is_internal_supplier",
-  "inter_company_reference",
-  "represents_company",
   "subscription_detail",
   "auto_repeat",
   "printing_settings",
   "letter_head",
-  "language",
-  "instructions",
+  "group_same_items",
   "column_break_97",
   "select_print_heading",
-  "other_details",
-  "remarks",
-  "group_same_items",
+  "language",
   "transporter_info",
   "transporter_name",
   "column_break5",
   "lr_no",
   "lr_date",
-  "is_old_subcontracting_flow"
+  "additional_info_section",
+  "instructions",
+  "is_internal_supplier",
+  "represents_company",
+  "inter_company_reference",
+  "column_break_131",
+  "remarks",
+  "range",
+  "amended_from",
+  "is_old_subcontracting_flow",
+  "other_details",
+  "connections_tab"
  ],
  "fields": [
   {
@@ -223,7 +236,6 @@
    "width": "100px"
   },
   {
-   "description": "Time at which materials were received",
    "fieldname": "posting_time",
    "fieldtype": "Time",
    "label": "Posting Time",
@@ -277,15 +289,14 @@
    "read_only": 1
   },
   {
-   "collapsible": 1,
    "fieldname": "section_addresses",
    "fieldtype": "Section Break",
-   "label": "Address and Contact"
+   "label": "Supplier Address"
   },
   {
    "fieldname": "supplier_address",
    "fieldtype": "Link",
-   "label": "Select Supplier Address",
+   "label": "Supplier Address",
    "options": "Address",
    "print_hide": 1
   },
@@ -330,7 +341,7 @@
   {
    "fieldname": "shipping_address",
    "fieldtype": "Link",
-   "label": "Select Shipping Address",
+   "label": "Shipping Address Template",
    "options": "Address",
    "print_hide": 1
   },
@@ -410,10 +421,11 @@
   },
   {
    "fieldname": "sec_warehouse",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1,
+   "label": "Items"
   },
   {
-   "description": "Sets 'Accepted Warehouse' in each row of the items table.",
    "fieldname": "set_warehouse",
    "fieldtype": "Link",
    "label": "Accepted Warehouse",
@@ -421,7 +433,6 @@
    "print_hide": 1
   },
   {
-   "description": "Sets 'Rejected Warehouse' in each row of the items table.",
    "fieldname": "rejected_warehouse",
    "fieldtype": "Link",
    "label": "Rejected Warehouse",
@@ -461,6 +472,7 @@
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
+   "hide_border": 1,
    "oldfieldtype": "Section Break",
    "options": "fa fa-shopping-cart"
   },
@@ -571,6 +583,7 @@
    "read_only": 1
   },
   {
+   "depends_on": "total_net_weight",
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "label": "Total Net Weight",
@@ -578,11 +591,11 @@
    "read_only": 1
   },
   {
-   "description": "Add / Edit Taxes and Charges",
    "fieldname": "taxes_charges_section",
    "fieldtype": "Section Break",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-money"
+   "hide_border": 1,
+   "label": "Taxes and Charges",
+   "oldfieldtype": "Section Break"
   },
   {
    "fieldname": "tax_category",
@@ -603,7 +616,8 @@
   },
   {
    "fieldname": "taxes_section",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "hide_border": 1
   },
   {
    "fieldname": "taxes_and_charges",
@@ -709,7 +723,6 @@
   },
   {
    "collapsible": 1,
-   "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_42",
    "fieldtype": "Section Break",
    "label": "Additional Discount"
@@ -749,7 +762,8 @@
   },
   {
    "fieldname": "section_break_46",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "label": "Totals"
   },
   {
    "fieldname": "base_grand_total",
@@ -842,15 +856,6 @@
    "label": "Disable Rounded Total"
   },
   {
-   "collapsible": 1,
-   "collapsible_depends_on": "terms",
-   "fieldname": "terms_section_break",
-   "fieldtype": "Section Break",
-   "label": "Terms and Conditions",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-legal"
-  },
-  {
    "fieldname": "tc_name",
    "fieldtype": "Link",
    "label": "Terms",
@@ -867,14 +872,6 @@
    "oldfieldtype": "Text Editor"
   },
   {
-   "collapsible": 1,
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Information",
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-file-text"
-  },
-  {
    "default": "Draft",
    "fieldname": "status",
    "fieldtype": "Select",
@@ -924,7 +921,6 @@
    "width": "50%"
   },
   {
-   "description": "Track this Purchase Receipt against any Project",
    "fieldname": "project",
    "fieldtype": "Link",
    "label": "Project",
@@ -941,7 +937,7 @@
   {
    "fieldname": "subscription_detail",
    "fieldtype": "Section Break",
-   "label": "Auto Repeat Detail"
+   "label": "Auto Repeat"
   },
   {
    "fieldname": "auto_repeat",
@@ -1025,7 +1021,7 @@
    "collapsible_depends_on": "transporter_name",
    "fieldname": "transporter_info",
    "fieldtype": "Section Break",
-   "label": "Transporter Details",
+   "label": "Transporter",
    "options": "fa fa-truck"
   },
   {
@@ -1087,7 +1083,7 @@
   {
    "fieldname": "billing_address",
    "fieldtype": "Link",
-   "label": "Select Billing Address",
+   "label": "Billing Address",
    "options": "Address"
   },
   {
@@ -1113,7 +1109,6 @@
   },
   {
    "depends_on": "eval: doc.is_internal_supplier",
-   "description": "Sets 'From Warehouse' in each row of the items table.",
    "fieldname": "set_from_warehouse",
    "fieldtype": "Link",
    "label": "Set From Warehouse",
@@ -1151,13 +1146,85 @@
    "hidden": 1,
    "label": "Is Old Subcontracting Flow",
    "read_only": 1
+  },
+  {
+   "fieldname": "address_and_contact_tab",
+   "fieldtype": "Tab Break",
+   "label": "Address & Contact"
+  },
+  {
+   "fieldname": "terms_tab",
+   "fieldtype": "Tab Break",
+   "label": "Terms"
+  },
+  {
+   "fieldname": "more_info_tab",
+   "fieldtype": "Tab Break",
+   "label": "More Info"
+  },
+  {
+   "fieldname": "connections_tab",
+   "fieldtype": "Tab Break",
+   "label": "Connections",
+   "show_dashboard": 1
+  },
+  {
+   "fieldname": "column_break_12",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_31",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_43",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_53",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "section_break_98",
+   "fieldtype": "Section Break",
+   "label": "Company Shipping Address"
+  },
+  {
+   "fieldname": "billing_address_section",
+   "fieldtype": "Section Break",
+   "label": "Company Billing Address"
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "status_section",
+   "fieldtype": "Section Break",
+   "label": "Status",
+   "oldfieldtype": "Section Break",
+   "options": "fa fa-file-text"
+  },
+  {
+   "fieldname": "additional_info_section",
+   "fieldtype": "Section Break",
+   "label": "Additional Info"
+  },
+  {
+   "fieldname": "column_break_131",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_100",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "column_break_104",
+   "fieldtype": "Column Break"
   }
  ],
  "icon": "fa fa-truck",
  "idx": 261,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-09-16 17:45:58.430132",
+ "modified": "2022-10-11 13:02:31.776256",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Purchase Receipt",
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.json b/erpnext/stock/doctype/quality_inspection/quality_inspection.json
index edfe7e9..db9322f 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.json
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.json
@@ -10,6 +10,7 @@
   "naming_series",
   "report_date",
   "status",
+  "manual_inspection",
   "column_break_4",
   "inspection_type",
   "reference_type",
@@ -231,6 +232,12 @@
    "label": "Status",
    "options": "\nAccepted\nRejected",
    "reqd": 1
+  },
+  {
+   "default": "0",
+   "fieldname": "manual_inspection",
+   "fieldtype": "Check",
+   "label": "Manual Inspection"
   }
  ],
  "icon": "fa fa-search",
@@ -238,10 +245,11 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2020-12-18 19:59:55.710300",
+ "modified": "2022-10-04 22:00:13.995221",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Quality Inspection",
+ "naming_rule": "By \"Naming Series\" field",
  "owner": "Administrator",
  "permissions": [
   {
@@ -262,5 +270,6 @@
  "search_fields": "item_code, report_date, reference_name",
  "show_name_in_global_search": 1,
  "sort_field": "modified",
- "sort_order": "ASC"
+ "sort_order": "ASC",
+ "states": []
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 13abfad..8ffd3f2 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -30,6 +30,9 @@
 		if self.readings:
 			self.inspect_and_set_status()
 
+	def before_submit(self):
+		self.validate_readings_status_mandatory()
+
 	@frappe.whitelist()
 	def get_item_specification_details(self):
 		if not self.quality_inspection_template:
@@ -65,6 +68,11 @@
 	def on_cancel(self):
 		self.update_qc_reference()
 
+	def validate_readings_status_mandatory(self):
+		for reading in self.readings:
+			if not reading.status:
+				frappe.throw(_("Row #{0}: Status is mandatory").format(reading.idx))
+
 	def update_qc_reference(self):
 		quality_inspection = self.name if self.docstatus == 1 else ""
 
@@ -124,6 +132,16 @@
 					# if not formula based check acceptance values set
 					self.set_status_based_on_acceptance_values(reading)
 
+		if not self.manual_inspection:
+			self.status = "Accepted"
+			for reading in self.readings:
+				if reading.status == "Rejected":
+					self.status = "Rejected"
+					frappe.msgprint(
+						_("Status set to rejected as there are one or more rejected readings."), alert=True
+					)
+					break
+
 	def set_status_based_on_acceptance_values(self, reading):
 		if not cint(reading.numeric):
 			result = reading.get("reading_value") == reading.get("value")
diff --git a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
index 144f138..4f19643 100644
--- a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
@@ -160,7 +160,7 @@
 		)
 
 		readings = [
-			{"specification": "Iron Content", "min_value": 0.1, "max_value": 0.9, "reading_1": "0.4"}
+			{"specification": "Iron Content", "min_value": 0.1, "max_value": 0.9, "reading_1": "1.0"}
 		]
 
 		qa = create_quality_inspection(
@@ -184,6 +184,38 @@
 		se.cancel()
 		frappe.db.set_value("Stock Settings", None, "action_if_quality_inspection_is_rejected", "Stop")
 
+	def test_qi_status(self):
+		make_stock_entry(
+			item_code="_Test Item with QA", target="_Test Warehouse - _TC", qty=1, basic_rate=100
+		)
+		dn = create_delivery_note(item_code="_Test Item with QA", do_not_submit=True)
+		qa = create_quality_inspection(
+			reference_type="Delivery Note", reference_name=dn.name, status="Accepted", do_not_save=True
+		)
+		qa.readings[0].manual_inspection = 1
+		qa.save()
+
+		# Case - 1: When there are one or more readings with rejected status and parent manual inspection is unchecked, then parent status should be set to rejected.
+		qa.status = "Accepted"
+		qa.manual_inspection = 0
+		qa.readings[0].status = "Rejected"
+		qa.save()
+		self.assertEqual(qa.status, "Rejected")
+
+		# Case - 2: When all readings have accepted status and parent manual inspection is unchecked, then parent status should be set to accepted.
+		qa.status = "Rejected"
+		qa.manual_inspection = 0
+		qa.readings[0].status = "Accepted"
+		qa.save()
+		self.assertEqual(qa.status, "Accepted")
+
+		# Case - 3: When parent manual inspection is checked, then parent status should not be changed.
+		qa.status = "Accepted"
+		qa.manual_inspection = 1
+		qa.readings[0].status = "Rejected"
+		qa.save()
+		self.assertEqual(qa.status, "Accepted")
+
 
 def create_quality_inspection(**args):
 	args = frappe._dict(args)
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 6042ed4..a2748d0 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -846,16 +846,15 @@
 
 	pos_transacted_sr_nos = query.run(as_dict=True)
 
-	reserved_sr_nos = []
-	returned_sr_nos = []
+	reserved_sr_nos = set()
+	returned_sr_nos = set()
 	for d in pos_transacted_sr_nos:
 		if d.is_return == 0:
-			reserved_sr_nos += get_serial_nos(d.serial_no)
+			[reserved_sr_nos.add(x) for x in get_serial_nos(d.serial_no)]
 		elif d.is_return == 1:
-			returned_sr_nos += get_serial_nos(d.serial_no)
+			[returned_sr_nos.add(x) for x in get_serial_nos(d.serial_no)]
 
-	for sr_no in returned_sr_nos:
-		reserved_sr_nos.remove(sr_no)
+	reserved_sr_nos = list(reserved_sr_nos - returned_sr_nos)
 
 	return reserved_sr_nos
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index abe98e2..7e9420d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -148,19 +148,19 @@
    "search_index": 1
   },
   {
-    "depends_on": "eval:doc.purpose==\"Send to Subcontractor\"",
-    "fieldname": "purchase_order",
-    "fieldtype": "Link",
-    "label": "Purchase Order",
-    "options": "Purchase Order"
+   "depends_on": "eval:doc.purpose==\"Send to Subcontractor\"",
+   "fieldname": "purchase_order",
+   "fieldtype": "Link",
+   "label": "Purchase Order",
+   "options": "Purchase Order"
   },
   {
-    "depends_on": "eval:doc.purpose==\"Send to Subcontractor\"",
-    "fieldname": "subcontracting_order",
-    "fieldtype": "Link",
-    "label": "Subcontracting Order",
-    "options": "Subcontracting Order"
-   },
+   "depends_on": "eval:doc.purpose==\"Send to Subcontractor\"",
+   "fieldname": "subcontracting_order",
+   "fieldtype": "Link",
+   "label": "Subcontracting Order",
+   "options": "Subcontracting Order"
+  },
   {
    "depends_on": "eval:doc.purpose==\"Sales Return\"",
    "fieldname": "delivery_note_no",
@@ -616,6 +616,7 @@
    "fieldname": "is_return",
    "fieldtype": "Check",
    "hidden": 1,
+   "in_list_view": 1,
    "label": "Is Return",
    "no_copy": 1,
    "print_hide": 1,
@@ -627,7 +628,7 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2022-05-02 05:21:39.060501",
+ "modified": "2022-10-07 14:39:51.943770",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock Entry",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 8bcd772..b116735 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -1212,13 +1212,19 @@
 
 	def update_work_order(self):
 		def _validate_work_order(pro_doc):
+			msg, title = "", ""
 			if flt(pro_doc.docstatus) != 1:
-				frappe.throw(_("Work Order {0} must be submitted").format(self.work_order))
+				msg = f"Work Order {self.work_order} must be submitted"
 
 			if pro_doc.status == "Stopped":
-				frappe.throw(
-					_("Transaction not allowed against stopped Work Order {0}").format(self.work_order)
-				)
+				msg = f"Transaction not allowed against stopped Work Order {self.work_order}"
+
+			if self.is_return and pro_doc.status not in ["Completed", "Closed"]:
+				title = _("Stock Return")
+				msg = f"Work Order {self.work_order} must be completed or closed"
+
+			if msg:
+				frappe.throw(_(msg), title=title)
 
 		if self.job_card:
 			job_doc = frappe.get_doc("Job Card", self.job_card)
@@ -1754,10 +1760,12 @@
 
 		for key, row in available_materials.items():
 			remaining_qty_to_produce = flt(wo_data.trans_qty) - flt(wo_data.produced_qty)
-			if remaining_qty_to_produce <= 0:
+			if remaining_qty_to_produce <= 0 and not self.is_return:
 				continue
 
-			qty = (flt(row.qty) * flt(self.fg_completed_qty)) / remaining_qty_to_produce
+			qty = flt(row.qty)
+			if not self.is_return:
+				qty = (flt(row.qty) * flt(self.fg_completed_qty)) / remaining_qty_to_produce
 
 			item = row.item_details
 			if cint(frappe.get_cached_value("UOM", item.stock_uom, "must_be_whole_number")):
@@ -1781,6 +1789,9 @@
 				self.update_item_in_stock_entry_detail(row, item, qty)
 
 	def update_item_in_stock_entry_detail(self, row, item, qty) -> None:
+		if not qty:
+			return
+
 		ste_item_details = {
 			"from_warehouse": item.warehouse,
 			"to_warehouse": "",
@@ -1794,6 +1805,9 @@
 			"original_item": item.original_item,
 		}
 
+		if self.is_return:
+			ste_item_details["to_warehouse"] = item.s_warehouse
+
 		if row.serial_nos:
 			serial_nos = row.serial_nos
 			if item.batch_no:
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_list.js b/erpnext/stock/doctype/stock_entry/stock_entry_list.js
index cbc3491..4eb0da1 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_list.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_list.js
@@ -1,8 +1,13 @@
 frappe.listview_settings['Stock Entry'] = {
 	add_fields: ["`tabStock Entry`.`from_warehouse`", "`tabStock Entry`.`to_warehouse`",
-		"`tabStock Entry`.`purpose`", "`tabStock Entry`.`work_order`", "`tabStock Entry`.`bom_no`"],
+		"`tabStock Entry`.`purpose`", "`tabStock Entry`.`work_order`", "`tabStock Entry`.`bom_no`",
+		"`tabStock Entry`.`is_return`"],
 	get_indicator: function (doc) {
-		if (doc.docstatus === 0) {
+		debugger
+		if(doc.is_return===1 && doc.purpose === "Material Transfer for Manufacture") {
+			return [__("Material Returned from WIP"), "orange",
+				"is_return,=,1|purpose,=,Material Transfer for Manufacture|docstatus,<,2"];
+		} else if (doc.docstatus === 0) {
 			return [__("Draft"), "red", "docstatus,=,0"];
 
 		} else if (doc.purpose === 'Send to Warehouse' && doc.per_transferred < 100) {